Skip to content

Commit

Permalink
[BZ #376]
Browse files Browse the repository at this point in the history
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].
  • Loading branch information
Ulrich Drepper committed Sep 26, 2004
1 parent 6721afe commit 6497a1d
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 26 deletions.
11 changes: 11 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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]

Expand Down
2 changes: 2 additions & 0 deletions math/libm-test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions sysdeps/generic/s_fdim.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions sysdeps/generic/s_fdimf.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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)
4 changes: 2 additions & 2 deletions sysdeps/generic/s_fdiml.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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)
10 changes: 6 additions & 4 deletions sysdeps/i386/i686/fpu/s_fdim.S
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions sysdeps/i386/i686/fpu/s_fdimf.S
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions sysdeps/i386/i686/fpu/s_fdiml.S
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions sysdeps/powerpc/fpu/s_fdim.c
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions sysdeps/powerpc/fpu/s_fdimf.c
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
10 changes: 6 additions & 4 deletions sysdeps/x86_64/fpu/s_fdiml.S
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6497a1d

Please sign in to comment.