Tho*_*mas 16 c c++ floating-point
我知道浮点数有舍入错误,但我想知道是否存在某些错误不适用的情况,例如乘以零.
对于所有浮点,任何数字的零次是否为零?
xan*_*tos 22
假:
0f * NAN == NAN
0f * INFINITY == NAN
Run Code Online (Sandbox Code Playgroud)
和......
0f * -1f == -0f (negative 0f), with 0f == -0f :-)
Run Code Online (Sandbox Code Playgroud)
(在Intel,VC++上,可能在任何使用IEEE 754-1985浮点的平台上)
关于ideone的示例(可能在某些Intel兼容平台上使用GCC)