Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 9 May 2013 21:14:25 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: Using float_t and double_t in math functions

* Rich Felker <dalias@...ifal.cx> [2013-05-09 10:57:14 -0400]:
> 
> Do you want to do it, or do you want me to? I don't mind but you're
> more familiar with the code and probably better aware of where it's
> okay to change. (BTW, it's probably not safe to change arg-reduction
> code, right?)
> 

i will do it, but it will take some time there are some simple
cases like sinf where it should clearly work (polynomial evals,
most temporaries)

but in other cases the excess precision can actually hurt
(correctly rounded operations, double-double representation,
over/underflow flags should be raised,..)

and there are some non-trivial cases
eg. acosh(x) for large x is ln(2*x), or to avoid overflow:

 log(x) + 0.693147180559945309417232121458176568;

which could be rewritten as

 log(x) + (double_t)0.693147180559945309417232121458176568L;

so gcc recognizes the const and uses fldln2 on i386
(which probably saves 1-2 bytes)
(the double rounding is not an issue for special consts)

so i think this will need to be done with
extensive testing and inspection of the generated code

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.