When do you use fp:strict as opposed to fp:precise? Is it better to use the former if I want "more precise" calculations and avoid rounding errors? What is the heuristic behind using either?
Asked
Active
Viewed 6,454 times
1 Answers
25
The standard IEEE 754 specifies a method for floating point calculations and storage of floating point values in memory.
Using fp:strict
means that all the rules of IEEE 754 are respected. fp:strict
is used to sustain bitwise compatibility between different compilers and platforms.
fp:precise
weakens some of the rules, however it warranties that the precision of the calculations will not be lost.
fp:fast
allows compiler specific optimizations and transformations of expressions containing floating point calculation. It is the fastest methods but the results will differ between different compilers and platforms.

Sergey K.
- 24,894
- 13
- 106
- 174
-
1Do you know where I can learn about the rules that the :precise relaxes? – unj2 Sep 20 '12 at 18:59
-
@unj2 https://learn.microsoft.com/en-us/cpp/build/reference/fp-specify-floating-point-behavior?view=msvc-170 – ScienceDiscoverer Jul 26 '22 at 10:56