Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Sorry for misreading your question.
It's (again) a floating point problem.
The mantissa does loose some digits at the end after adding 10 and substracting doesn't bring them back. A proper test is either to stay integer from the beginning till the end or to calculate the difference and to compare against a threshold (trickier). Please note how 14.5 doesn't have this problem since 1/2 is a power of 2 (i.e. only 0s are lost when shifting the mantissa)
updatesee Re: eq vs == and Humans have too many fingers for more details
Cheers Rolf ( addicted to the Perl Programming Language) In reply to Re^3: Okay! What!?!?!?
by LanX
|
|