Re: Floating point differences at compile-time

2010-01-01 Thread Don
bearophile wrote: I don't understand where the result differences come from in this code: import std.math: sqrt, PI; import std.stdio: writefln; void main() { const double x1 = 3.0 * PI / 16.0; writefln("%.17f", sqrt(1.0 / x1)); double x2 = 3.0 * PI / 16.0; writefln("%.17f", sqrt(1.0 /

Floating point differences at compile-time

2009-12-31 Thread bearophile
I don't understand where the result differences come from in this code: import std.math: sqrt, PI; import std.stdio: writefln; void main() { const double x1 = 3.0 * PI / 16.0; writefln("%.17f", sqrt(1.0 / x1)); double x2 = 3.0 * PI / 16.0; writefln("%.17f", sqrt(1.0 / x2)); real x3 =