PDA

View Full Version : Curious bug


Actor
09-26-2010, 11:32 AM
I'm posting not as a plea for help but rather to describe an anomaly that others may find interesting.

I've had a rather curious bug surface in a program I'm developing that uses the BRIS single DRF file as input. I get a "range check error" when reading the BRIS speed figure, the DRF figure and the DRF variant. I had declared these to be unsigned integers since I did not anticipate these to ever be negative, but changing them to signed integers seems to have solved the problem, at least in the sense that the program no longer crashes.

However, even though changing the type to signed integer seems to have cured the problem, examination of the output does not reveal any occurrences of negative values for these variables. Second, the bug was always in the fifth race back, never in the first through fourth or in the sixth through the tenth.

Curiouser and curiouser.
:confused:

DJofSD
09-26-2010, 11:47 AM
In what language are you doing your development?

Actor
09-26-2010, 12:21 PM
In what language are you doing your development?
Turbo Pascal 7.0

Dave Schwartz
09-26-2010, 12:24 PM
The DRF variant, can, by definition, be negative. That would happen on a day that was so fast that the average was higher than the track record. Imagine a day with only one turf race and a new record was set. Voila! Negative variant!

Depending upon how the BRIS speed ratings are scaled, a zero might be as slow as "reasonably allowed." A race that is slower that that could easily produce a negative number.

In my own software, I have utilized a rule that says, "Any horse more than 40 lengths behind gets a zero" to avoid just those situations.


Finally, another possibility is that the system is using negative numbers to indicate something else.


All this commentary falls into the area of "for what its worth" because I truly know very little about BRIS numbers. (Note: In some circles this is known as a "code 46" comment. :bang: )


Regards,
Dave Schwartz