Here I have a strange problem, and a workaround. I don't know whether I have a bug in my code, or a bug in something else (my eye for example).

The code itself serves some specialistic purpose, which has to do something with event-counting and autocorrelation. It falls beyond the scope of this question, so I skip that for now.

The core of my problem lies in the following line:

$left_idx++ if $store->[$left_idx] < $start;
This will sometimes falsely evaluate to false. I tracked down the values, and it only failed in 7 out of a range of 1000 used values. A workaround was quickly found:
# $left_idx++ if $store->[$left_idx] < $start; #normal $left_idx++ if ($store->[$left_idx]+1) < ($start+1); #0.6 bug workar +ound
Just add 1 to each side of the equation, and everything works fine. I traced down some numbers, to give you an idea:
1.6 [8]: 0.8 1 1.2 1.4 1.8 2 2.2 + 2.4 2.6 2.2 [11]: 1.4 1.6 1.8 2 2.4 2.6 2.8 + 3 3.2 4.4 [22]: 3.6 3.8 4 4.2 4.6 4.8 5 + 5.2 5.4 8.8 [44]: 8 8.2 8.4 8.6 9 9.2 9.4 + 9.6 9.8 16.6 [83]: 15.8 16 16.2 16.4 16.8 17 17.2 + 17.4 17.6 32.2 [161]: 31.4 31.6 31.8 32 32.4 32.6 32.8 + 33 33.2 64.4 [322]: 63.6 63.8 64 64.2 64.6 64.8 65 + 65.2 65.4
I also saved part of my debugging session comparing the values:
DB<25> x ($store->[3]) == $start 0 '' DB<26> x ($store->[3]+0) == $start 0 '' DB<27> x $start 0 0.6 DB<28> x $store->[3] 0 0.6 DB<29> x 0.6 == $start 0 '' DB<30> x $start == 0.6 0 '' DB<31> x 0.6 == 0.6 0 1 DB<32> x ($store->[3]+0) == ($start+0) 0 '' DB<33> x ($store->[3]+1) == ($start+1) 0 1
Pretty strange, isn't it? OK, now I give you the complete code (in a package) and code to call it:
Edit 2001-04-06 by tye to comment out long code listing. To see the code, view the HTML source for this page.

Please shoot, point me to my mistakes, but most of all, please explain me what's going on here!

Thanks a lot,

Jeroen
"We are not alone"(FZ)


In reply to Comparison misses a true in *some* cases by jeroenes

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.