What's the difference of /fp:fast and /fp:precise when calling CRT math functions directly? #96118
-
When searching for difference between FP modes, I know that the handling of written arithmetic expressions is different. What about calling CRT math functions directly? I can only see difference when calling double functions with float parameters, float functions will be called instead in /fp:fast. However, the comments in floatsingle.cpp/floatdouble.cpp suggests there are some differences. The code was written a long time ago, so I don't know if the comments are still relevant. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
It seems that current comments by function is still relevant, for example the implementation of ceiling is different. If we want a CRT call, we should be able to P/Invoke it directly. |
Beta Was this translation helpful? Give feedback.
-
There used to be more difference for 32-bit where the x87 FPU could be used, but this has been drastically reduced with the requirement of SSE/SSE2 on most modern computers. There can still be subtle differences in handling for subnormal inputs, NaNs, or other edge cases. Likewise there can sometimes be differences in how some code is allowed to be computed, such as |
Beta Was this translation helpful? Give feedback.
There used to be more difference for 32-bit where the x87 FPU could be used, but this has been drastically reduced with the requirement of SSE/SSE2 on most modern computers.
There can still be subtle differences in handling for subnormal inputs, NaNs, or other edge cases. Likewise there can sometimes be differences in how some code is allowed to be computed, such as
(a * b) + c
being allowed to emitfma(a, b, c)
instead.