I honestly have no idea what's causing this. I can't even replicate the bug in a separate test.

In a nut shell, I am doing a set of comparisons between values in this manner (actual snippet): return ('','') if ($rsx < $sxL); where $rsx and $syH are both numbers (generally floats). In a strange bug, whenever either scalar sports the value of 1000, then the comparison above results in a TRUE!

The scalars hold values that are pretty much abused and beaten. Sometimes, I'll introduce values into the formula (this is where I get the value 1000 from), usually done if a formula can't be solved (eg divide by zero or if I want the value to specifically come out to 1000, even if the result would've been something different). In other words, if I reach that point where I'm comparing the two scalars, I know that I will sometimes be comparing two values of 1000 and I expect it not to return TRUE.

Yet, it appears to return TRUE nearly every time I end up checking if 1000 < 1000

I am truly baffled by this. Have I completely misunderstood the usage between <, > and their counterparts lt and gt? Is there some behavior difference between integers and floating numbers? Is perl misinterpreting my intent that these are indeed numbers and are treating my scalars as strings?

Some of the things I've tried:

I am so close to stamping this bug out and moving on to the next stage of my project. :(


In reply to When 1000 is less than 1000 by SavannahLion

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.