A Philosophy of Software Design
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Mon Jun 29 08:05:01 UTC 2026
On 29/06/2026 7:58 PM, Walter Bright wrote:
> On 6/28/2026 5:14 AM, Alexandru Ermicioi wrote:
>> You'd typically pass this info in exception itself, therefore getting
>> file and number, and runtime values causing this.
>
> There wouldn't be an exception thrown if:
>
> ```d
> double d;
> ```
>
> default initializes it to 0.0 instead of NaN. You will never have an
> indication that the calculation produces the wrong value.
If it propergates yes, you need a read barrier check and throw if NaN.
But you can also throw static analysis at it to catch royally stupid
cases like so:
```d
void thing(float arg) {
float f;
return f + arg * 2;
}
```
More information about the Digitalmars-d
mailing list