floating point min, max, min_normal
bearophile
bearophileHUGS at lycos.com
Wed Aug 11 19:56:47 PDT 2010
I vaguely remember Don talking about this, but I don't remember the conclusions, and there is something strange.
In this page among the properties of floating point values the min seems missing:
http://www.digitalmars.com/d/2.0/property.html
Yet the min is present and returns the same value as min_normal:
import std.stdio;
void main() {
writeln(double.min); // 2.22507e-308
writeln(double.max); // 1.79769e+308
writeln(double.min_normal); // 2.22507e-308
writeln(-double.max); // -1.79769e+308
}
In generic code I have used min, but the min for floating point values is very different from the min for integral values. Is it possible to change double.min to something similar to -double.max? Otherwise I suggest to just remove double.min, because it's confusing for me and my code.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list