Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between /fp:strict and /fp:precise?

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?

like image 749
unj2 Avatar asked Sep 20 '12 14:09

unj2


1 Answers

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.

like image 84
Sergey K. Avatar answered Oct 20 '22 00:10

Sergey K.