5 ms·
What about NaN values? Are the runtime errors or do they propagate down the chain of execution? Are they comparable?
by qppo 6y ago
What about NaN values? Are the runtime errors or do they propagate down the chain of execution? Are they comparable?
- skulk 6y agoFor a high-level API, shouldn't this be expressed with types such as a `Result<T,E>` at the library level? edit: now that I think about it, that would require some really nice optional chaining syntax to be even slightly usable.
- fouronnes3 6y agoOh now I'm curious if IEEE 754 NaN rules are isomorphic to a number optional type with monadic chaining syntax
- SAI_Peregrinus 6y agoBasically. And you can stick error codes in the value too, so you can know down the line what caused the NaN.
- neolog 6y agoThere are no NaN values in the real numbers.
- fanf2 6y agoYou need some way to cope with operations that don’t have real results for some values, such as log and sqrt of negative numbers
- molyss 6y agoyou can just represent those as a pair of real numbers, one for the real part, and one for the imaginary part. As long as you only (recursively) apply exponential and trig functions on those numbers, I believe you'll stay within the realm of complex numbers.
- nsajko 6y agoThe paper says the Java code throws exceptions in such cases.