diff options
Diffstat (limited to 'src/math/copysign.c')
| -rw-r--r-- | src/math/copysign.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/math/copysign.c b/src/math/copysign.c index a462348b..2ace3c1d 100644 --- a/src/math/copysign.c +++ b/src/math/copysign.c @@ -4,7 +4,16 @@ TYPE TGFN(copysign)(TYPE x, TYPE y) { - return x - y; + if (isnan(x)) { + if (signbit(y)) { + /* return -NaN; */ + } else { + /* return NaN; */ + } + } + + x = TGFN(fabs)(x); + return signbit(y) ? -x : x; } /* |
