float init 0 request
claptrap
clap at trap.com
Fri Aug 21 23:22:07 UTC 2026
On Friday, 21 August 2026 at 22:18:38 UTC, Walter Bright wrote:
> On 8/21/2026 2:24 PM, claptrap wrote:
>> That's only a problem with recursive algorithms,
>
> The point is the unlikeliness of detecting an error because the
> coefficient was 0 instead of 0.1, and the result is plausible.
OK so the error accumulation thing was a side quest?
> In the Gimli Glider incident, the pilots did not notice the
> result was off by factor of 2.
>
> The idea that a wrong value of 3.6 instead of a correct 4.0 is
> more detectable than a wrong value of NaN is incorrect.
I have never made that argument.
My argument is that given that NaN doesnt guarantee you will get
an obvious wrong value, and that zero init will likely reduce the
total amount of errors, the trade of is less clear cut that it
would seem. Because you are arguing **a single case**, where zero
is wrong, and NaN always makes it obvious. That's cherry picking.
I think that when your mental model is that "float init to NaN"
is just like "pointer init to void" it makes it seem very clear
cut when its really not, they are not equivalent.
Lets be honest, if zero init was such a source of bugs, it'd be
an easy case to make because we'd all be so sick of hunting zero
init integer bugs. But no one ever makes that point, because it's
really a non issue.
If you had chose zero init for floats 20 years ago everyone would
yeah fine.
More information about the Digitalmars-d
mailing list