Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 29 Jan 2012 17:34:55 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: libm

* Rich Felker <dalias@...ifal.cx> [2012-01-27 14:34:24 -0500]:
> On Fri, Jan 27, 2012 at 08:01:18PM +0100, Pascal Cuoq wrote:
> > On Fri, Jan 27, 2012 at 5:02 PM, Szabolcs Nagy <nsz@...t70.net> wrote:
> > 
> > > meanwhile i compared some implementations
> > > openbsd, freebsd and glibc are worth to look at
> > >
> > 
> > Sorry to intrude in your conversation, but for reasons of
> > my own I was recently looking for an aesthetically pleasing
> > single-precision implementation of trigonometric functions,
> > and some of the single-precisions functions out there are
> > so ugly that I would seriously consider implementing
> > these in musl by a call to their respective double-precision
> > counterparts, despite the disadvantages. At least it's compact.
> 
> *Nod*, this is the way I'm leaning for single-precision anyway. The
> only possible reason to reconsider is that some systems (i.e. some
> ARMs) have slow software emulation of double precision but native
> single precision, or so I'm told...
> 

yes, this is good for code sizeand maintainability

some code will expect faster execution when it uses
the float versions so some benchmarking will be needed
for arm to see the tradeoffs

> > Consider:
> > http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libm/src/k_cosf.c?rev=1.3;content-type=text%2Fplain
> > 
> > The code written at Sun and that many libms reuse must
> > have been double-precision only, and someone had to
> > make a single-precision version of them at some point.
> > Without the analysis that led to the original code, one
> > cannot blame Ian Lance Taylor for staying close
> > to the double-precision function:
> > http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libm/src/k_cos.c?rev=1.4;content-type=text%2Fplain
> > 
> > But the degree of the polynomial in the single-precision version
> > is about twice what is necessary, and the coefficients
> > look like coefficients of the Taylor expansion rounded to
> > nearest float, when they should be Chebyshev coefficients.
> 
> Agreed, this is ridiculous.

bruce d evans in freebsd fixed these

http://svnweb.FreeBSD.org/base/stable/9/lib/msun/src/k_cosf.c?view=log
see rev 152951 and 152869

openbsd is a bit behind freebsd libm
improvements in some places
but freebsd misses some long double
functions implemented in openbsd
that's why i recommended looking into
both of them

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.