mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: libm
Date: Sun, 29 Jan 2012 17:34:55 +0100	[thread overview]
Message-ID: <20120129163454.GH31975@port70.net> (raw)
In-Reply-To: <20120127193424.GA567@brightrain.aerifal.cx>

* Rich Felker <dalias@aerifal.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@port70.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



  reply	other threads:[~2012-01-29 16:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-23 16:41 libm Szabolcs Nagy
2012-01-23 17:07 ` libm Rich Felker
2012-01-23 19:12   ` libm Szabolcs Nagy
2012-01-27 16:02     ` libm Szabolcs Nagy
2012-01-27 19:01       ` libm Pascal Cuoq
2012-01-27 19:34         ` libm Rich Felker
2012-01-29 16:34           ` Szabolcs Nagy [this message]
2012-02-27 21:02   ` libm Szabolcs Nagy
2012-02-27 22:24     ` libm Rich Felker
2012-03-03 22:57       ` libm Szabolcs Nagy
2012-03-04  6:53         ` libm Rich Felker
2012-03-04 14:50           ` libm Szabolcs Nagy
2012-03-04 18:43             ` libm Rich Felker
2012-03-05  8:51               ` libm Szabolcs Nagy
2012-03-05 14:04                 ` libm Rich Felker
2012-03-05 15:17                   ` libm Szabolcs Nagy
2012-03-05 15:25                     ` libm Rich Felker
2012-03-09 10:22                     ` libm Rich Felker
2012-03-09 10:57                       ` libm Szabolcs Nagy
2012-03-09 16:01                         ` libm Rich Felker
2012-03-09 11:09                       ` libm Szabolcs Nagy
2012-03-09 15:56                         ` libm Rich Felker
2012-03-09 17:02                           ` libm Rich Felker
2012-03-10  3:28                             ` libm Rich Felker
2012-03-10 12:45                               ` libm Szabolcs Nagy
2012-03-10 13:12                                 ` libm Rich Felker
2012-03-10 16:38                                   ` libm Szabolcs Nagy
2012-03-05 11:08             ` libm Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120129163454.GH31975@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).