deckard has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; my $x1 = 44.7; my $x2 = 44.9-0.2; print "numbers $x1 $x2 - "; if ($x1 == $x2) { print "SAME\n"; } else { print "NOT SAME\n"; }
The result is:
numbers 44.7 44.7 - NOT SAME
This left me very much unsure. What's wrong? Perl or me?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl numeric expressions
by merlyn (Sage) on Nov 28, 2005 at 13:19 UTC | |
|
Re: perl numeric expressions
by monkey_boy (Priest) on Nov 28, 2005 at 13:23 UTC | |
by deckard (Initiate) on Nov 28, 2005 at 13:34 UTC | |
|
Re: perl numeric expressions
by tphyahoo (Vicar) on Nov 28, 2005 at 13:50 UTC | |
|
Re: perl numeric expressions
by secret (Beadle) on Nov 28, 2005 at 13:23 UTC | |
by tphyahoo (Vicar) on Nov 28, 2005 at 13:35 UTC | |
by secret (Beadle) on Nov 28, 2005 at 13:40 UTC | |
by tphyahoo (Vicar) on Nov 28, 2005 at 14:39 UTC | |
|
Re: perl numeric expressions
by swampyankee (Parson) on Nov 28, 2005 at 15:24 UTC |