From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/554 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: libm Date: Sun, 29 Jan 2012 17:34:55 +0100 Message-ID: <20120129163454.GH31975@port70.net> References: <20120123164152.GZ31975@port70.net> <20120123170715.GA197@brightrain.aerifal.cx> <20120123191215.GA31975@port70.net> <20120127160209.GF31975@port70.net> <20120127193424.GA567@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1327854910 1867 80.91.229.3 (29 Jan 2012 16:35:10 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 29 Jan 2012 16:35:10 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-555-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jan 29 17:35:10 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1RrXie-0006uQ-8p for gllmg-musl@plane.gmane.org; Sun, 29 Jan 2012 17:35:08 +0100 Original-Received: (qmail 32080 invoked by uid 550); 29 Jan 2012 16:35:07 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 32072 invoked from network); 29 Jan 2012 16:35:07 -0000 Content-Disposition: inline In-Reply-To: <20120127193424.GA567@brightrain.aerifal.cx> User-Agent: Mutt/1.5.20 (2009-06-14) Xref: news.gmane.org gmane.linux.lib.musl.general:554 Archived-At: * Rich Felker [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 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