This is the mail archive of the
glibc-bugs@sources.redhat.com
mailing list for the glibc project.
[Bug math/602] powerpc rint() function is buggy in the rounding toward -inf and +inf modes
- From: "sjmunroe at us dot ibm dot com" <sourceware-bugzilla at sources dot redhat dot com>
- To: glibc-bugs at sources dot redhat dot com
- Date: 20 Dec 2004 22:55:54 -0000
- Subject: [Bug math/602] powerpc rint() function is buggy in the rounding toward -inf and +inf modes
- References: <20041208163310.602.vincent+libc@vinc17.org>
- Reply-to: sourceware-bugzilla at sources dot redhat dot com
------- Additional Comments From sjmunroe at us dot ibm dot com 2004-12-20 22:55 -------
Fixed in cvs since June 11 2004. The C implementation mentioned above was
replace With optimized asm implementations:
2004-06-11 Dwayne Grant McConnell <dgm69@us.ibm.com>
* sysdeps/powerpc/fpu/s_lround.c: Removed.
* sysdeps/powerpc/fpu/s_lroundf.c: Removed.
* sysdeps/powerpc/powerpc32/fpu/s_ceilf.S: New file.
* sysdeps/powerpc/powerpc32/fpu/s_ceil.S: New file.
* sysdeps/powerpc/powerpc32/fpu/s_floorf.S: New file.
* sysdeps/powerpc/powerpc32/fpu/s_floor.S: New file.
* sysdeps/powerpc/powerpc32/fpu/s_lrint.c: Removed.
* sysdeps/powerpc/powerpc32/fpu/s_lrint.S: New file.
* sysdeps/powerpc/powerpc32/fpu/s_lroundf.S: New file.
* sysdeps/powerpc/powerpc32/fpu/s_lround.S: New file.
* sysdeps/powerpc/powerpc32/fpu/s_rintf.S: New file.
* sysdeps/powerpc/powerpc32/fpu/s_rint.S: New file.
* sysdeps/powerpc/powerpc32/fpu/s_roundf.S: New file.
* sysdeps/powerpc/powerpc32/fpu/s_round.S: New file.
* sysdeps/powerpc/powerpc32/fpu/s_truncf.S: New file.
* sysdeps/powerpc/powerpc32/fpu/s_trunc.S: New file.
looks like the sysdeps/powerpc/fpu/s_rint.c is redundant and should be removed.
The equivalent PPC64 changes when in April 29 2004.
Anyway on SLES9 and RHEL4 we get:
Rounding toward -oo
-3.0 -2.0 -1.0 -0.0 0.0 1.0 2.0 3.0
casttoint -3 -2 -1 0 0 1 2 3
trunc -3.0 -2.0 -1.0 -0.0 0.0 1.0 2.0 3.0
floor -3.0 -2.0 -1.0 -0.0 0.0 1.0 2.0 3.0
ceil -3.0 -2.0 -1.0 -0.0 0.0 1.0 2.0 3.0
round -3.0 -2.0 -1.0 -0.0 0.0 1.0 2.0 3.0
nearbyint -3.0 -2.0 -1.0 -0.0 0.0 1.0 2.0 3.0
myrint -3.0 -2.0 -1.0 -0.0 0.0 1.0 2.0 3.0
rint -3.0 -2.0 -1.0 -0.0 0.0 1.0 2.0 3.0
However it look like there is another problem with fractional values that round
to zero:
Rounding toward -oo
-1.5 -1.0 -0.5 -0.0 0.0 0.5 1.0 1.5
casttoint -1 -1 0 0 0 0 1 1
trunc -1.0 -1.0 -0.0 -0.0 0.0 0.0 1.0 1.0
floor -2.0 -1.0 -1.0 -0.0 0.0 0.0 1.0 1.0
ceil -1.0 -1.0 -0.0 -0.0 0.0 1.0 1.0 2.0
round -2.0 -1.0 -1.0 -0.0 0.0 1.0 1.0 2.0
nearbyint -2.0 -1.0 -1.0 -0.0 0.0 0.0 1.0 1.0
myrint -2.0 -1.0 -1.0 -0.0 0.0 0.0 1.0 1.0
rint -1.0 -1.0 0.0 -0.0 0.0 -0.0 1.0 1.0
I'll look into this tommorrow.
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=602
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.