in reply to Multiply with 100 in perl

$ perl -e 'printf "%.20f\n", 75.600 * 100' 7559.99999999999909050530 $ perl -e 'printf "%.0f\n", 75.600 * 100' 7560

See What Every Programmer Should Know About Floating-Point Arithmetic for more information.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Multiply with 100 in perl
by Anonymous Monk on Nov 11, 2015 at 18:42 UTC

    Just to add a little information, the problem isn't multiplying by 100, it's the 75.6

    $ perl -e 'printf "%.20f\n", 75.600' 75.59999999999999431566