in reply to How to determine MIN and MAX values for floating point number

$ perl -MPOSIX -le 'print POSIX::FLT_MAX; print POSIX::FLT_MIN'
-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: How to determine MIN and MAX values for floating point number
by ysth (Canon) on Dec 10, 2003 at 00:06 UTC
    I think you'll want DBL_MAX and DBL_MIN (or LDBL_MAX and LDBL_MIN if $Config{uselongdouble}). And LDBL_MIN isn't the minimum value, it's the minimum possible normal value greater than 0. "Normal" here means a number with the full mantissa's worth of precision. Most implementations allow "subnormal" numbers that can get smaller. For example:
    $ perl -MPOSIX=DBL_MIN -wle'print DBL_MIN()' 2.2250738585072e-308 $ perl -MPOSIX=DBL_MIN -wle'print DBL_MIN()/2**52' 4.94065645841247e-324 $ perl -MPOSIX=DBL_MIN -wle'print DBL_MIN()/2**53' 0
Re: Re: How to determine MIN and MAX values for floating point number
by Joost (Canon) on Dec 09, 2003 at 21:37 UTC