summaryrefslogtreecommitdiff
path: root/math/s_fdiml.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2009-11-16 18:07:33 +0100
committerAndreas Schwab <schwab@redhat.com>2009-11-16 18:07:33 +0100
commit82e87e05c7ba3748c7f64b7a887908cd6ac9e40c (patch)
tree01be2aeead555597cdcec20786de7977bec16af9 /math/s_fdiml.c
parented26dd532e36429cbc6e60ae3be41719be9a5b89 (diff)
parentdacc52e1922491a3b0e613a8be2d488871315114 (diff)
Merge commit 'glibc-2.10.2' into fedora/2.10/master
Diffstat (limited to 'math/s_fdiml.c')
-rw-r--r--math/s_fdiml.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/math/s_fdiml.c b/math/s_fdiml.c
index 70246bafbd..f3072b99a0 100644
--- a/math/s_fdiml.c
+++ b/math/s_fdiml.c
@@ -1,5 +1,5 @@
/* Return positive difference between arguments.
- Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -18,6 +18,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <errno.h>
#include <math.h>
long double
@@ -31,6 +32,13 @@ __fdiml (long double x, long double y)
/* Raise invalid flag. */
return x - y;
- return x <= y ? 0 : x - y;
+ if (x <= y)
+ return 0.0f;
+
+ long double r = x - y;
+ if (fpclassify (r) == FP_INFINITE)
+ __set_errno (ERANGE);
+
+ return r;
}
weak_alias (__fdiml, fdiml)