double.min - should be 5e-324?

Ellery Newcomer ellery-newcomer at utulsa.edu
Sat Dec 4 14:38:59 PST 2010


On 12/04/2010 03:22 PM, Dmitry Olshansky wrote:
> Well, to keep things short, double.min returns something weird.
> See the following for demonstration:
> import std.stdio;
>
> void main(){
> double r = double.max, r2 = double.min;
> writeln(r);//1.79769e+308
> r *= 2;//test if it's max
> writeln(r); // infinity, ok
>
> writeln(r2);//2.22507e-308, wtf ?
> r2 /= 2.0;
> writeln(r2);// 1.11254e-308, a logical consequence of above
>
> double dmin = 5e-324;
> writeln(dmin);// 4.94066e-324
> dmin /= 2.0;
> writefln(dmin);// 0
> }
>

looks like double.min is returning double.min_normal

oddly enough, double.min is undefined in the spec


More information about the Digitalmars-d mailing list