Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: IEEE-754 calculation - best way?

by BrowserUk (Pope)
on Jan 30, 2013 at 22:40 UTC ( #1016169=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    print 0.29 * 50;;
    14.5
    
  2. or download this
    printf "%.20f\n", 0.29 * 50;;
    14.49999999999999800000
    
  3. or download this
    printf "%.20f\n",  eval eval( 0.29 ) * eval( 50 );;
    14.50000000000000000000
    
  4. or download this
    printf "%.20f\n",  eval 0.29 * 50;;
    14.50000000000000000000
    
  5. or download this
    $n = 0.29 * 50; printf "%.20f\n",  "$n";;
    14.50000000000000000000