summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-26 10:11:59 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-26 10:11:59 +0000
commit6497a1d081505a2d0b50e06fcdca71d5f0a11192 (patch)
tree1893c3063f3970cd55a323a992d6c2dcebb0b009
parent6721afe294991fc1862e417263ccb04bf04599d6 (diff)
downloadglibc-6497a1d081505a2d0b50e06fcdca71d5f0a11192.tar.gz
[BZ #376]
Update. * sysdeps/generic/s_fdim.c: Handle +inf/+inf * sysdeps/generic/s_fdimf.c: Likewise. * sysdeps/generic/s_fdiml.c: Likewise. * sysdeps/i386/i686/fpu/s_fdim.S: Likewise. * sysdeps/i386/i686/fpu/s_fdimf.S: Likewise. * sysdeps/i386/i686/fpu/s_fdiml.S: Likewise. * sysdeps/powerpc/fpu/s_fdim.c: Likewise. * sysdeps/powerpc/fpu/s_fdimf.c: Likewise. * sysdeps/x86_64/fpu/s_fdiml.S: Likewise. * math/libm-test.inc (fdim_test): Add test case. [BZ #376].
-rw-r--r--ChangeLog11
-rw-r--r--math/libm-test.inc2
-rw-r--r--sysdeps/generic/s_fdim.c4
-rw-r--r--sysdeps/generic/s_fdimf.c4
-rw-r--r--sysdeps/generic/s_fdiml.c4
-rw-r--r--sysdeps/i386/i686/fpu/s_fdim.S10
-rw-r--r--sysdeps/i386/i686/fpu/s_fdimf.S10
-rw-r--r--sysdeps/i386/i686/fpu/s_fdiml.S10
-rw-r--r--sysdeps/powerpc/fpu/s_fdim.c4
-rw-r--r--sysdeps/powerpc/fpu/s_fdimf.c4
-rw-r--r--sysdeps/x86_64/fpu/s_fdiml.S10
11 files changed, 47 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index f9387143e8..91a59dab05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2004-09-26 Ulrich Drepper <drepper@redhat.com>
+ * sysdeps/generic/s_fdim.c: Handle +inf/+inf
+ * sysdeps/generic/s_fdimf.c: Likewise.
+ * sysdeps/generic/s_fdiml.c: Likewise.
+ * sysdeps/i386/i686/fpu/s_fdim.S: Likewise.
+ * sysdeps/i386/i686/fpu/s_fdimf.S: Likewise.
+ * sysdeps/i386/i686/fpu/s_fdiml.S: Likewise.
+ * sysdeps/powerpc/fpu/s_fdim.c: Likewise.
+ * sysdeps/powerpc/fpu/s_fdimf.c: Likewise.
+ * sysdeps/x86_64/fpu/s_fdiml.S: Likewise.
+ * math/libm-test.inc (fdim_test): Add test case. [BZ #376].
+
* sysdeps/generic/bits/types.h: Fix __SQUAD_TYPE and __UQUAD_TYPE
for compilers without __GLIBC_HAVE_LONG_LONG. [BZ #362]
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 729fce9369..b23ec8430f 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -2557,6 +2557,8 @@ fdim_test (void)
TEST_ff_f (fdim, nan_value, minus_infty, nan_value);
TEST_ff_f (fdim, nan_value, nan_value, nan_value);
+ TEST_ff_f (fdim, plus_infty, plus_infty, 0);
+
END (fdim);
}
diff --git a/sysdeps/generic/s_fdim.c b/sysdeps/generic/s_fdim.c
index 201f93692e..5804e631c3 100644
--- a/sysdeps/generic/s_fdim.c
+++ b/sysdeps/generic/s_fdim.c
@@ -1,5 +1,5 @@
/* Return positive difference between arguments.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -31,7 +31,7 @@ __fdim (double x, double y)
/* Raise invalid flag. */
return x - y;
- return x < y ? 0 : x - y;
+ return x <= y ? 0 : x - y;
}
weak_alias (__fdim, fdim)
#ifdef NO_LONG_DOUBLE
diff --git a/sysdeps/generic/s_fdimf.c b/sysdeps/generic/s_fdimf.c
index 64d54b7fe4..2f3ce303ae 100644
--- a/sysdeps/generic/s_fdimf.c
+++ b/sysdeps/generic/s_fdimf.c
@@ -1,5 +1,5 @@
/* Return positive difference between arguments.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -31,6 +31,6 @@ __fdimf (float x, float y)
/* Raise invalid flag. */
return x - y;
- return x < y ? 0 : x - y;
+ return x <= y ? 0 : x - y;
}
weak_alias (__fdimf, fdimf)
diff --git a/sysdeps/generic/s_fdiml.c b/sysdeps/generic/s_fdiml.c
index 83049ae732..70246bafbd 100644
--- a/sysdeps/generic/s_fdiml.c
+++ b/sysdeps/generic/s_fdiml.c
@@ -1,5 +1,5 @@
/* Return positive difference between arguments.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -31,6 +31,6 @@ __fdiml (long double x, long double y)
/* Raise invalid flag. */
return x - y;
- return x < y ? 0 : x - y;
+ return x <= y ? 0 : x - y;
}
weak_alias (__fdiml, fdiml)
diff --git a/sysdeps/i386/i686/fpu/s_fdim.S b/sysdeps/i386/i686/fpu/s_fdim.S
index e610973a56..30ecff4e7c 100644
--- a/sysdeps/i386/i686/fpu/s_fdim.S
+++ b/sysdeps/i386/i686/fpu/s_fdim.S
@@ -1,5 +1,5 @@
/* Compute positive difference.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -28,12 +28,14 @@ ENTRY(__fdim)
fucomi %st(1), %st
jp 1f
- fsubrp %st, %st(1)
+ jc 3f
+ fstp %st(1)
fldz
- fcomi %st(1), %st
- fcmovb %st(1), %st
jmp 2f
+3: fsubrp %st, %st(1)
+ ret
+
1: fucomi %st(0), %st
fcmovnu %st(1), %st
2: fstp %st(1)
diff --git a/sysdeps/i386/i686/fpu/s_fdimf.S b/sysdeps/i386/i686/fpu/s_fdimf.S
index a22cbe9d66..888df14b6f 100644
--- a/sysdeps/i386/i686/fpu/s_fdimf.S
+++ b/sysdeps/i386/i686/fpu/s_fdimf.S
@@ -1,5 +1,5 @@
/* Compute positive difference.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -28,12 +28,14 @@ ENTRY(__fdimf)
fucomi %st(1), %st
jp 1f
- fsubrp %st, %st(1)
+ jc 3f
+ fstp %st(1)
fldz
- fcomi %st(1), %st
- fcmovb %st(1), %st
jmp 2f
+3: fsubrp %st, %st(1)
+ ret
+
1: fucomi %st(0), %st
fcmovnu %st(1), %st
2: fstp %st(1)
diff --git a/sysdeps/i386/i686/fpu/s_fdiml.S b/sysdeps/i386/i686/fpu/s_fdiml.S
index fa3c51e462..cb0e26e367 100644
--- a/sysdeps/i386/i686/fpu/s_fdiml.S
+++ b/sysdeps/i386/i686/fpu/s_fdiml.S
@@ -1,5 +1,5 @@
/* Compute positive difference.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -28,12 +28,14 @@ ENTRY(__fdiml)
fucomi %st(1), %st
jp 1f
- fsubrp %st, %st(1)
+ jc 3f
+ fstp %st(1)
fldz
- fcomi %st(1), %st
- fcmovb %st(1), %st
jmp 2f
+3: fsubrp %st, %st(1)
+ ret
+
1: fucomi %st(0), %st
fcmovnu %st(1), %st
2: fstp %st(1)
diff --git a/sysdeps/powerpc/fpu/s_fdim.c b/sysdeps/powerpc/fpu/s_fdim.c
index 165e2ff5a5..2b767addab 100644
--- a/sysdeps/powerpc/fpu/s_fdim.c
+++ b/sysdeps/powerpc/fpu/s_fdim.c
@@ -1,5 +1,5 @@
/* Return positive difference between arguments.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,7 +22,7 @@
double
__fdim (double x, double y)
{
- return x < y ? 0 : x - y;
+ return x <= y ? 0 : x - y;
}
weak_alias (__fdim, fdim)
#ifdef NO_LONG_DOUBLE
diff --git a/sysdeps/powerpc/fpu/s_fdimf.c b/sysdeps/powerpc/fpu/s_fdimf.c
index 997ec8983f..a27c1e4039 100644
--- a/sysdeps/powerpc/fpu/s_fdimf.c
+++ b/sysdeps/powerpc/fpu/s_fdimf.c
@@ -1,5 +1,5 @@
/* Return positive difference between arguments.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,6 @@
float
__fdimf (float x, float y)
{
- return x < y ? 0 : x - y;
+ return x <= y ? 0 : x - y;
}
weak_alias (__fdimf, fdimf)
diff --git a/sysdeps/x86_64/fpu/s_fdiml.S b/sysdeps/x86_64/fpu/s_fdiml.S
index 3460b0f979..d63ca00ef1 100644
--- a/sysdeps/x86_64/fpu/s_fdiml.S
+++ b/sysdeps/x86_64/fpu/s_fdiml.S
@@ -1,5 +1,5 @@
/* Compute positive difference.
- Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -28,12 +28,14 @@ ENTRY(__fdiml)
fucomi %st(1), %st
jp 1f
- fsubrp %st, %st(1)
+ jc 3f
+ fstp %st(1)
fldz
- fcomi %st(1), %st
- fcmovb %st(1), %st
jmp 2f
+3: fsubrp %st, %st(1)
+ ret
+
1: fucomi %st(0), %st
fcmovnu %st(1), %st
2: fstp %st(1)