-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid calculations produce NaN? #115
Comments
Nat foo; // NaN
Nat bar = 0; // 0
Nat baz = {}; // 0 ? |
I wonder if an implementation with an anonymous struct like this might make sense: struct {} NaN;
void something(decltype(NaN)) {}
int main() {
something(NaN);
} Or perhaps we should just name it Not sure yet whether we want to simply allow it to propagate unknowns or for it to also be the result of invalid operations such as square root of negatives, divide by zero and what-not. We currently throw an exception for the latter case and this may or may not be more desirable. We'd also need to
Hmmm, maybe we really should name it something like Empty or Missing instead. |
Alas, after getting feedback on this design (https://codereview.stackexchange.com/questions/283562/api-design-for-implementing-nan-unknown-values-for-custom-numeric-type), I will not be having empty objects produce |
This could be a useful feature for distinguishing between integer zero and "invalid" values, such as in the return values for
numeric_limits
members that aren't defined, such as max().The text was updated successfully, but these errors were encountered: