On Monday, 29 April 2024 at 03:51:09 UTC, Bruce Carneal wrote:
> If they're silent how do you know they failed? Also, if you do know they failed why would NaN be unhelpful in localizing the problem? It could be initialization, or it could be something else along the way.
Having a game made in D, NaN is my #1 pain to deal with during graphics development. In other Langs, if I mess up some code, I usually get a picture that is wrong. A wrong colour, wrong position on screen, etc. With NaN, all rendering pipeline silently fails if even a single number was uninitialised somewhere. So I can't even take a guess at what number exactly was not initialised, I have to run a debugger and start from the beginning to see where it went wrong. If floats initialize to 0, you can usually guess what was forgotten because you know the math.
> OTOH, NaNs can be very helpful when trying to track down FP problems, with improper (unthinking) initialization probably near the top of the list.
NaN was literally never helpful to me, because it removes indirect information from that allows me to take a guess. If you know what kind of math you're doing, you can usually assume where the code went wrong depending on the result you get. With NaNs, you only get one part of this information.