summaryrefslogtreecommitdiff
path: root/neg.c
diff options
context:
space:
mode:
Diffstat (limited to 'neg.c')
-rw-r--r--neg.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/neg.c b/neg.c
index 185a836c1..181c7f9cf 100644
--- a/neg.c
+++ b/neg.c
@@ -1,6 +1,6 @@
/* mpfr_neg -- change the sign of a floating-point number
-Copyright 1999, 2000, 2001 Free Software Foundation.
+Copyright 1999, 2000, 2001, 2004 Free Software Foundation.
This file is part of the MPFR Library.
Contributed by the Spaces project (LORIA/LIP6).
@@ -29,6 +29,10 @@ mpfr_neg (mpfr_ptr a, mpfr_srcptr b, mp_rnd_t rnd_mode)
{
if (a != b)
return mpfr_set4 (a, b, rnd_mode, -MPFR_SIGN(b));
+ else if (MPFR_IS_NAN(b))
+ {
+ MPFR_RET_NAN;
+ }
else
{
MPFR_CHANGE_SIGN(a);