Summary: | sincos() is incorrect for large inputs on x86_64 | ||
---|---|---|---|
Product: | glibc | Reporter: | Vincent Lefèvre <vincent-srcware> |
Component: | math | Assignee: | Carlos O'Donell <carlos> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | aj, bugdal, carlos, ppluzhnikov |
Priority: | P2 | Keywords: | glibc_2.15 |
Version: | 2.13 | Flags: | fweimer:
security-
|
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Bug Depends on: | |||
Bug Blocks: | 13851, 13852, 13854, 15563 |
Description
Vincent Lefèvre
2012-02-03 14:41:59 UTC
Btw. x86-64 uses the same fsincos instruction like x86. For the reference about the hardware trig instructions, you can see "Intel® 64 and IA-32 Architectures Software Developer's Manual Volume 1: Basic Architecture" on: http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html in particular Section 8.1.3.2, which says: "The FPTAN, FSIN, FCOS, and FSINCOS instructions set the C2 flag to 1 to indicate that the source operand is beyond the allowable range of ±2^63 and clear the C2 flag if the source operand is within the allowable range." So, outside the interval [-2^63,+2^63] ("allowable range"), these instructions must not be used (or they can be used, but with a fallback if the C2 flag is set to 1). But note that the glibc implementation is more accurate, even with (very probably) correct rounding, so that it is better to use it anyway. Andreas posted a possible patch for this issue here: http://cygwin.com/ml/libc-alpha/2012-02/msg00194.html GCC discussion is here: http://gcc.gnu.org/ml/gcc/2012-02/msg00072.html This is fixed now for sincos, sin and cos on i386 and x86-64. I'm opening separate bugs for float and long double. *** Bug 13837 has been marked as a duplicate of this bug. *** *** Bug 260998 has been marked as a duplicate of this bug. *** Seen from the domain http://volichat.com Page where seen: http://volichat.com/adult-chat-rooms Marked for reference. Resolved as fixed @bugzilla. |