in reply to Re: When is a 2 not a 2?
in thread When is a 2 not a 2?

That's a good explanation and sound advice. So, is there any harm in doing "$x" ne "2"? Or would it be better to use sprintf "%.02f", $x to convert it?

Replies are listed 'Best First'.
Re^3: When is a 2 not a 2?
by ikegami (Patriarch) on Jan 31, 2008 at 02:14 UTC

    So, is there any harm in doing "$x" ne "2"?

    When, to end the loop? It'll work for this loop. What about longer loops? The loop counter would accumulate more and more error, potentially skewering your numbers and potentially making the loop into an infinite loop. Seems to me to be plain bad practice to knowingly accumulate an error.