in reply to Problems with number resolution

davies has already linked you to What Every Programmer Should Know About Floating-Point Arithmetic, which is definitely worth reading, and poj has shown you one possible solution. Here are two more that give the desired output:

If you don't care about the inaccurate internal representation, use printf for output, as in: printf "%.2f => %.2f\n", $_, $x;

If you don't care so much about the performance of your program, stick a use bignum; at the top of your program (or at least in the lexical scope of the code you showed).

Replies are listed 'Best First'.
Re^2: Problems with number resolution
by Anonymous Monk on Jan 02, 2018 at 07:28 UTC

    Thanks haukex for your comment.

    Using "use bignum" is the solution what I was looking for.