Re: floating point inconsistency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/16/2010 4:20 AM, Christoph Groth wrote:
I can avoid this inconsistency while staying
portable by computing cos(x) as sqrt(1 - sin(x)^2).

As you are concerned about low order bits (and, you say, portability), and you said you wished to avoid 387 functions,
double tmp = sin(x);
.... sqrt((1+tmp)*(1-tmp))...
would be more often accurate.
I haven't heard of satisfactory solution of the question of SSE2 math functions for glibc, but that goes further off topic.

--
Tim Prince


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux