This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
rint/nearbyint for x86-64
- From: John Reiser <jreiser at BitWagon dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 10 Mar 2008 08:21:53 -0700
- Subject: rint/nearbyint for x86-64
Regarding rint/nearbyint for x86_64, Andreas Jaeger <aj@suse.de> wrote:
> These use the x87 fpu and passed all tests. Does anybody have a better
> implementation using only the SSE unit?
Take absolute value, ADD then SUBtract the power of 2 whose LSB in f.p.
representation has the place value 1 (namely: 2**23 or 2**52), copy the
sign of the original argument.
This uses the hardware rounding for the ADD as round-to-integer.
Beware exceptional conditions: NaN, denormal, overflow on ADD.
Compare implementation with non-x86 and non-IEEE754 hardware.
Measure the speed and other characteristics [define "better."]
--
John Reiser, jreiser@BitWagon.com