Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
Compare, two identical numbers are not the same?!
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Justin C, post: 4866971"] This one is really confusing me. I have a comparison: $totalIndividualWeights != $param{weight} and when they're both 42.6 (probably other numbers too, but this is the problem someone has, and has come to me with) Perl says they're not the same: my $totalIndividualWeights = addIndividualWeights(); if ($totalIndividualWeights != $param{weight}){ print "Weight does not add up to total weight given on the first form.\$totalIndividualWeights = $totalIndividualWeights \n \$param{weight} = $param{weight}"; } The print statement says both weights are 42.6. $param{weight} was input by the user, $totalIndividualWeights is reached by adding several user inputs: 2.86, 9.94, 9.98, 9.88, 9.94 Does perl have a problem with empty decimal places? What I mean is, the inputs are to two decimals, but the result is only using one, is perl thinking "42.60" and not matching 42.6? Thank you for any help you can give with this. Justin. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
Compare, two identical numbers are not the same?!
Top