summaryrefslogtreecommitdiffstats
path: root/Macros.h
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2024-01-07 08:52:44 +0800
committerBenBE <BenBE@geshi.org>2024-01-08 13:13:29 +0100
commit7bf8f02de27fe2b4feba05104c9a335d422b1641 (patch)
tree1ae3ed9849aefe942578841eefe18466b79fceca /Macros.h
parentc3b4a770c02c28662980014b5a893e01451ec2b2 (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.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/Macros.h b/Macros.h
index 01cc7774..051bedbc 100644
--- a/Macros.h
+++ b/Macros.h
@@ -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);
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy