Handling big FP numbers

Adam D. Ruppe destructionator at gmail.com
Sat Feb 9 02:54:18 UTC 2019


On Saturday, 9 February 2019 at 02:46:52 UTC, Murilo wrote:
> But I used the type double in D which is supposed to be only 64 
> bits long and not 80 bits long, the type real is the one which 
> is supposed to be 80 bits long. Right?

Right, BUT the compile time stuff is done before that.

double a = 1.0 * 2.0;

The 1.0*2.0 is done as real inside the compiler, then the 
*result* is assigned to the 64 bit double.

Whereas in a C++ compiler, that would be done 64 bit throughout. 
So the different intermediate rounding can give a different 
result.

(The `real` thing in D was a massive mistake. It is slow and adds 
nothing but confusion.)


More information about the Digitalmars-d-learn mailing list