硬浮点数和软浮点数有什么区别? [英] What's the difference between hard and soft floating point numbers?

查看:45
本文介绍了硬浮点数和软浮点数有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用交叉工具链编译 C 代码时,链接器会打印警告页面,指出我的可执行文件使用硬浮点数,但我的 libc 使用软浮点数.有什么区别?

When I compile C code with my cross toolchain, the linker prints pages of warnings saying that my executable uses hard floats but my libc uses soft floats. What's the difference?

推荐答案

硬浮点数使用片上浮点单元.软浮动在软件中模拟一个.区别在于速度.看到两者都用在同一个目标架构上很奇怪,因为芯片要么有 FPU,要么没有.您可以使用 -msoft-float 在 GCC 中启用软浮点.如果您使用它,您可能需要重新编译您的 libc 以使用它.

Hard floats use an on-chip floating point unit. Soft floats emulate one in software. The difference is speed. It's strange to see both used on the same target architecture, since the chip either has an FPU or doesn't. You can enable soft floating point in GCC with -msoft-float. You may want to recompile your libc to use hardware floating point if you use it.

这篇关于硬浮点数和软浮点数有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆