From 06696f40afe58a231e2531c8bf6d9f0dadb92e51 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Sun, 3 Mar 2019 21:25:50 -0500 Subject: outline details from C18 annex F --- src/math/hypot.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/math/hypot.c') diff --git a/src/math/hypot.c b/src/math/hypot.c index 6ab2ecf7..ce902c59 100644 --- a/src/math/hypot.c +++ b/src/math/hypot.c @@ -4,6 +4,14 @@ TYPE TGFN(hypot)(TYPE x, TYPE y) { + if (fpclassify(y) == FP_ZERO) { + return fabs(x); + } + + if (fpclassify(x) == FP_INFINITE) { + return INFINITY; + } + return x - y; } -- cgit v1.2.1