mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: Using float_t and double_t in math functions
Date: Thu, 9 May 2013 21:14:25 +0200	[thread overview]
Message-ID: <20130509191425.GH12689@port70.net> (raw)
In-Reply-To: <20130509145714.GL20323@brightrain.aerifal.cx>

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


  reply	other threads:[~2013-05-09 19:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-09  1:43 Rich Felker
2013-05-09 13:21 ` Szabolcs Nagy
2013-05-09 14:57   ` Rich Felker
2013-05-09 19:14     ` Szabolcs Nagy [this message]
2013-05-09 16:02   ` Rich Felker

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=20130509191425.GH12689@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).