On 8/11/2012 3:01 PM, F i L wrote:
Walter Bright wrote:
I'd rather have a 100 easy to find bugs than 1 unnoticed one that went out in
the field.

That's just the thing, bugs are arguably easier to hunt down when things default
to a consistent, usable value.

Many, many programming bugs trace back to assumptions that floating point numbers act like ints. There's just no way to avoid knowing and understanding the differences.


When variables are defaulted to Zero, I have a
guarantee that any propagated NaN bug is _not_ coming from them (directly). With
NaN defaults, I only have a guarantee that the value _might_ be coming said
variable.

I don't see why this is a bad thing. The fact is, with NaN you know there is a bug. With 0, you may never realize there is a problem. Andrei wrote me about the output of a program he is working on having billions of result values, and he noticed a few were NaNs, which he traced back to a bug. If the bug had set the float value to 0, there's no way he would have ever noticed the issue.

It's all about daubing bugs with day-glo orange paint so you know there's a problem. Painting them with camo is not the right solution.


Reply via email to