From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13874 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Damian McGuckin Newsgroups: gmane.linux.lib.musl.general Subject: ATANH Date: Wed, 27 Feb 2019 13:59:41 +1100 (AEDT) Message-ID: Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="209143"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) To: musl@lists.openwall.com Original-X-From: musl-return-13890-gllmg-musl=m.gmane.org@lists.openwall.com Wed Feb 27 04:00:01 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1gypRw-000sH3-MR for gllmg-musl@m.gmane.org; Wed, 27 Feb 2019 04:00:00 +0100 Original-Received: (qmail 13775 invoked by uid 550); 27 Feb 2019 02:59:58 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 13744 invoked from network); 27 Feb 2019 02:59:57 -0000 X-Authentication-Warning: key0.esi.com.au: damianm owned process doing -bs Xref: news.gmane.org gmane.linux.lib.musl.general:13874 Archived-At: 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