in reply to Re^3: substitution "0" in decimals
in thread substitution "0" in decimals

In happens when converting to floats. Now, when converting floats to strings, Perl only uses a limited (6?) number of digits after the decimal point, if the number before the decimal point isn't 0. In this case (and many others), this cancels out the loss of significance.

In many cases, you will not notice the difference, Perl will just "do what I mean". But sometimes, you'll be surprised. String to float and back isn't always free.

Replies are listed 'Best First'.
Re^5: substitution "0" in decimals
by LanX (Saint) on Dec 08, 2009 at 13:22 UTC
    I was wondering if it is really stored as a float.

    your explanation with limited number of digits is good ( I was thinking of that), but should include rounding!

    > In many cases, you will not notice the difference, Perl will just "do what I mean". But sometimes, you'll be surprised. String to float and back isn't always free.

    Plz, can you give me an example?

    UPDATE: Never mind, see update to Re: substitution "0" in decimals!

    Cheers Rolf