Floating point minimum values are positive?

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Mon Jul 22 15:00:47 PDT 2013


On Monday, 22 July 2013 at 21:13:49 UTC, bearophile wrote:
> 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 :-)

It so happens that for the code in question I did, and had got 
that warning, and made the switch. I just hadn't realized that in 
either case the value would be positive! I just noticed because 
of a case where I was initializing a value to real.min_normal and 
then taking the max of this variable and zero, and I'd 
anticipated 0 would be the max.

> 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.


It's no problem to use -max, I'd just never encountered this 
quirk before.

Thanks to all for the advice and insight! :-)


More information about the Digitalmars-d-learn mailing list