in reply to Re: Multiply with 100 in perl
in thread Multiply with 100 in perl

Floating point arithmetic has limited accuracy try bignum library.

perl -Mbignum -e 'printf"%.20F\n", 75.600 * 100;'

Replies are listed 'Best First'.
Re^3: Multiply with 100 in perl
by Anonymous Monk on Nov 12, 2015 at 01:39 UTC

    Bignum is good, but printf still converts to float.

    $ perl -Mbignum -e 'printf "%.32g\n", 75.600 * 10**30' 75599999999999995986368094273536 $ perl -Mbignum -le 'print 75.600 * 10**30' 75600000000000000000000000000000