mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Damian McGuckin <damianm@esi.com.au>
To: musl@lists.openwall.com
Subject: ATANH
Date: Wed, 27 Feb 2019 13:59:41 +1100 (AEDT)	[thread overview]
Message-ID: <alpine.LRH.2.02.1902271353470.18595@key0.esi.com.au> (raw)


The comments for this routine say:

  * atanh(x) = log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2 ~= x + x^3/3 + o(x^5)

There is a point where atanh(x) can be approximated by just x to machine 
precision. This is where the exponent of x is less than some number, or 
where x itself is less than some number.

In MUSL, for the 80-bit version, directly from the code, this is

 	2^(-LDBL_MANT_DIG/2) = 0x1.0p-32;

Interestingly, this same number, is  used double atanh and float atanhf.

Note that in fdlibm,  0x1.0p-28 is used for all types

In fact, isn't

 		x * (1 + x^2/3) == x (after roundoff)

if
 	x < 2^(p/2),

i.e. 0x1.0p-26 for double, 0x1.0p-12 for float.

Note that for 80-bit wide, it is 0x1.0p-32 agreeing with MUSL!!

Regards - Damian

Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer


             reply	other threads:[~2019-02-27  2:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27  2:59 Damian McGuckin [this message]
2019-02-27 10:38 ` ATANH 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=alpine.LRH.2.02.1902271353470.18595@key0.esi.com.au \
    --to=damianm@esi.com.au \
    --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).