This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/5857] rint is broken on x86_64 systems for values from 262144.75 to 524286.75 stepped by 2


------- Additional Comments From mark dot h dot elliott at lmco dot com  2008-03-27 17:29 -------
Subject: RE:  rint is broken on x86_64 systems for values from 262144.75 to 524286.75 stepped by 2

I've been using a rint replacement C function that uses the frndint
instruction and that seems to work correctly and efficiently.

double rint (double fSt)
{
	double	fSc;

	__asm__ ("frndint": "=t" (fSc): "0" (fSt));

	return (fSc);
}

This works for both "i386" and "x86_64" architectures.

	Mark

-----Original Message-----
From: aj at suse dot de [mailto:sourceware-bugzilla@sourceware.org] 
Sent: Sunday, March 09, 2008 7:51 AM
To: Elliott, Mark H
Subject: [Bug math/5857] rint is broken on x86_64 systems for values
from 262144.75 to 524286.75 stepped by 2


------- Additional Comments From aj at suse dot de  2008-03-09 13:50
-------
you asked:
"But the real question is Why isn't rint using the frndint instruction
on x86_64
systems!!??".

The double type on x86-64 systems is in general in XMM (SSE) registers.
So, to
use frndint you would need to push the value from the xmm register to
the x87
fpu and back.  Such an implementation was not done so far.

-- 
           What    |Removed                     |Added
------------------------------------------------------------------------
----
   Last reconfirmed|0000-00-00 00:00:00         |2008-03-09 13:50:47
               date|                            |
            Summary|rint is broken on x86_64    |rint is broken on
x86_64
                   |systems for values from     |systems for values from
                   |262144.75 to 524286.75      |262144.75 to 524286.75
                   |stepped by 2                |stepped by 2


http://sourceware.org/bugzilla/show_bug.cgi?id=5857

------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=5857

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]