jeroenes has asked for the wisdom of the Perl Monks concerning the following question:
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:
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;
# $left_idx++ if $store->[$left_idx] < $start; #normal $left_idx++ if ($store->[$left_idx]+1) < ($start+1); #0.6 bug workar +ound
I also saved part of my debugging session comparing the values: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
Pretty strange, isn't it? OK, now I give you the complete code (in a package) and code to call it: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
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)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Comparison misses a true in *some* cases
by merlyn (Sage) on Apr 06, 2001 at 19:33 UTC | |
by tye (Sage) on Apr 06, 2001 at 21:22 UTC | |
by jeroenes (Priest) on Apr 07, 2001 at 13:07 UTC | |
Re: Comparison misses a true in *some* cases
by busunsl (Vicar) on Apr 06, 2001 at 19:27 UTC | |
by japhy (Canon) on Apr 06, 2001 at 20:58 UTC | |
by jeroenes (Priest) on Apr 06, 2001 at 19:31 UTC |