On a Linux system I execute the following code:
-------------X Code Start X---------------
#!/usr/bin/perl -wT
$string1 = 12e-4;
$string2 = 1.2e-3;
if ( $string1 > $string2 ) {
print "$string1 is greater than $string2\n";
}
elsif ( $string1 == $string2 ) {
print "$string1 is equal to $string2\n";
}
else {
print "$string1 is less than $string2\n";
}
--------------X Code End X----------------
The result I get is
0.0012 is less than 0.0012After some testing, I've found that numbers in exponential notation with exponents in the range from "-1" to "-3" produce the same weird behavior. I do not get any such weird results on my HP-UX 11.00 system or my Win2K box. After reading through http://perldoc.perl.org/perlnumber.html, I'm wondering if this is due to losses of information in the conversion of data types because of limitations/features of the C compiler on the Linux system.
If any of you Masters has seen this issue, would you know how to either (1) account for this by adding Perl code or (2) recompile Perl on this Linux system using some other flags? FYI, I was not involved with the compiling of Perl on this system in any way.
Thanks for any help you all can provide.
In reply to bug in Perl compilation? by bkgallo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |