2 ms·
I really wish languages would stop following this antipattern of throwing exceptions instead of allowing normal handling of Inf and NaN values. There are some
by chroem- 6y ago
I really wish languages would stop following this antipattern of throwing exceptions instead of allowing normal handling of Inf and NaN values. There are some cases where I really do want to perform comparisons against a non-finite value, or do arithmetic with one. Non-finite values are part of the floating point spec, and partitioning off this part of FP functionality is non-standard behavior.
- FeepingCreature 6y agoIt used to be the case that nans, infs, denormals, anything that wasn't a normal float, were really really slow to process. This seems to have improved somewhat over the last decade, but it's easy to see why it soured people on the concept of propagating nans - it's basically saying "there's a value called the Slow, and it turns everything it touches Slow, and you should let the Slow propagate throughout your data." No, I don't want the Slow to propagate through my data, I want to catch it where it is created so I can fix the Slow there and stop it from becoming an issue in the first place. ("Demons of Slow! Be thou bound by the secret power of Fast, whose sign is DAZ and FTZ! By the command of fesetexcept(FE_ALL_EXCEPT) I shall expose thee!")