Movement against float.init being nan

wjoe invalid at example.com
Tue Aug 23 17:23:08 UTC 2022


On Monday, 22 August 2022 at 14:16:14 UTC, Steven Schveighoffer 
wrote:
> Imagine you are making a 3-d model, and one vertex out of 100k 
> is NaN. How will you notice it? A single missing triangle 
> somewhere?
>
> But make that vertex 0, and all of a sudden your model has this 
> weird triangle sticking out extending to the origin, and is 
> completely obvious.
>
> -Steve

It could just as well be a very obvious hole, as easy to make out 
as that spike. Also that number may not end up being 0 so the 
spike may be very subtle.
If I wouldn't notice, i.e. neither visibly nor due to a 
performance impact, I probably wouldn't even start looking.
I've seen these spikes due to errors in hardware or operating it 
outside specifications (over clocking, under volting), too.
But the artifact needn't necessarily be a triangle. Could be a 
color or transparency channel.
A NaN value is incorrect - would you know the same if it's any 
real number ? Or would you have to ask the artist ?
Would you even notice ? It may be off by just 0.35 in the blue 
channel - the eye is very insensitive to blue. It may not be 
obvious because of color blindness, or the monitor isn't 
calibrated to the color space, or any amount of different reasons.
But someone else may notice and send a bug report and when you 
start investigating, a NaN will tell you the truth even if you 
can't visually see it yourself.

In shapes it may be more obvious but anything in art goes and NaN 
is still always wrong.
It's like a math professor asking their students to name the 
highest number they know and professor is going to provide a 
higher number. Next thing that happens is that someone calls 
"infinity" - infinity isn't a number.

Maybe the situation could be improved in that the compiler adds 
checks for NaN akin to bounds checking and throws a NaN_Error. 
This way the error could be caught even before sending wrong data 
to the GPU - or whatever API.


More information about the Digitalmars-d mailing list