libmatheval.git -

summary refs log tree commit diff
path: root/lib/xmath.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xmath.c')
-rw-r--r--lib/xmath.c 6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/xmath.c b/lib/xmath.c
index 1310b2f..1bd5f81 100644
--- a/lib/xmath.c
+++ b/lib/xmath.c
@@ -162,7 +162,7 @@ math_step(double x)
/*
* Calculate step function value.
*/
- return (x < 0) ? 0 : 1;
+ return MATH_ISNAN(x) ? x : ((x < 0) ? 0 : 1);
}
double
@@ -171,7 +171,7 @@ math_delta(double x)
/*
* Calculate delta function value.
*/
- return (x == 0) ? MATH_INFINITY : 0;
+ return MATH_ISNAN(x) ? x : ((x == 0) ? MATH_INFINITY : 0);
}
double
@@ -180,5 +180,5 @@ math_nandelta(double x)
/*
* Calculate modified delta function value.
*/
- return (x == 0) ? MATH_NAN : 0;
+ return MATH_ISNAN(x) ? x : ((x == 0) ? MATH_NAN : 0);
}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月03日 11:55:03 +0000

AltStyle によって変換されたページ (->オリジナル) /