Floating point minimum values are positive?

bearophile bearophileHUGS at lycos.com
Mon Jul 22 14:13:47 PDT 2013


Joseph Rushton Wakeling:

> I just realized that while e.g. int.min gives a negative value, 
> the floating point equivalent, e.g. double.min, gives a very 
> small positive value -- I guess the smallest possible positive 
> value.

Please always compile all your D code with the "-wi" switch, 
because Walter is deaf at my suggestions to have informational 
warnings active on default in D compilations :-)

void main() {
     immutable x = double.min;
}

==>

test.d(2): Warning: min property is deprecated, use min_normal 
instead

float/double/real min property will be removed. You will have to 
use -max. This a patch over an historical accident of C++ limits 
values.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list