diff options
author | Explorer09 <explorer09@gmail.com> | 2024-01-07 08:52:44 +0800 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2024-01-08 13:13:29 +0100 |
commit | 7bf8f02de27fe2b4feba05104c9a335d422b1641 (patch) | |
tree | 1ae3ed9849aefe942578841eefe18466b79fceca /Macros.h | |
parent | c3b4a770c02c28662980014b5a893e01451ec2b2 (diff) |
Clarify isNonnegative() behavior in comments
Also fix some comments of isNaN() and isPositive() functions.
No code changes.
Diffstat (limited to 'Macros.h')
-rw-r--r-- | Macros.h | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -119,19 +119,20 @@ in the source distribution for its full text. #endif /* Cheaper function for checking NaNs. Unlike the standard isnan(), this may - throw an FP exception on a "signaling" NaN. + throw an FP exception on a "signaling NaN". (ISO/IEC TS 18661-1 and the C23 standard stated that isnan() throws no - exceptions even with a "signaling" NaN) */ + exceptions even with a "signaling NaN") */ static inline bool isNaN(double x) { return !isgreaterequal(x, x); } -/* Checks if x is nonnegative. Returns false if x is NaN. */ +/* Checks if x >= 0.0 but returns false if x is NaN. Because IEEE 754 considers + -0.0 == 0.0, this function treats both zeros as nonnegative. */ static inline bool isNonnegative(double x) { return isgreaterequal(x, 0.0); } -/* Checks if x is positive. Returns false if x is NaN. */ +/* Checks if x > 0.0 but returns false if x is NaN. */ static inline bool isPositive(double x) { return isgreater(x, 0.0); } |