Hello Masters,

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.0012
After 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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.