qbxk has asked for the wisdom of the Perl Monks concerning the following question:
I won't tell you what gets printed, because I don't believe it. Try it on your command line. What do you get? Why?????? Then, should this be different? It is.my $x = 1.1 - 1.0; print(qq[$x <= 0.1 ? ] . ($x <= 0.1 ? q[yes] : q[no] ));
fwiw,my $x = 1.0 - 0.9; print(qq[$x <= 0.1 ? ] . ($x <= 0.1 ? q[yes] : q[no] ));
using my $x = 1.2 - 1.1 is even more interesting.....~$: perl -v This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
i look forward to your wise clarifications in the morning, and easing my mind greatly, this monk must now get some rest....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: bug in floating point math?
by ikegami (Patriarch) on Sep 23, 2010 at 03:40 UTC | |
by AnomalousMonk (Archbishop) on Sep 23, 2010 at 04:30 UTC | |
|
Re: bug in floating point math?
by BrowserUk (Patriarch) on Sep 23, 2010 at 09:04 UTC |