about summary refs log tree commit diff
path: root/src/math
diff options
context:
space:
mode:
authornsz <nsz@port70.net>2012-03-19 00:59:16 +0100
committernsz <nsz@port70.net>2012-03-19 00:59:16 +0100
commitd09a83f613c1d06442ed920ec55a0e5eedacb422 (patch)
tree3c3ee1c4ef4b681f7b0f618c172b3f99ca37e25d /src/math
parentb1cbd70743f0e0e0295e92c3e38d7599114db8c6 (diff)
downloadmusl-d09a83f613c1d06442ed920ec55a0e5eedacb422.tar.gz
musl-d09a83f613c1d06442ed920ec55a0e5eedacb422.tar.xz
musl-d09a83f613c1d06442ed920ec55a0e5eedacb422.zip
fmal bug fix: nan input should not raise exception
Diffstat (limited to 'src/math')
-rw-r--r--src/math/fmal.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/math/fmal.c b/src/math/fmal.c
index 3944c292..cbaf46eb 100644
--- a/src/math/fmal.c
+++ b/src/math/fmal.c
@@ -173,14 +173,14 @@ long double fmal(long double x, long double y, long double z)
 	 * return values here are crucial in handling special cases involving
 	 * infinities, NaNs, overflows, and signed zeroes correctly.
 	 */
-	if (x == 0.0 || y == 0.0)
-		return (x * y + z);
-	if (z == 0.0)
-		return (x * y);
 	if (!isfinite(x) || !isfinite(y))
 		return (x * y + z);
 	if (!isfinite(z))
 		return (z);
+	if (x == 0.0 || y == 0.0)
+		return (x * y + z);
+	if (z == 0.0)
+		return (x * y);
 
 	xs = frexpl(x, &ex);
 	ys = frexpl(y, &ey);