Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 9 Mar 2024 21:23:19 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: Damian McGuckin <damianm@....com.au>
Cc: MUSL <musl@...ts.openwall.com>
Subject: Re: Re: cacosh.c - Comment needs correction

* Damian McGuckin <damianm@....com.au> [2024-03-08 15:44:32 +1100]:

> On Fri, 8 Mar 2024, Damian McGuckin wrote:
> 
> > 
> > The routine produces the correct answer.
> > 
> > However, currently, the comment at the top says
> > 
> > 	/* acosh(z) = i acos(z) */
> > 
> > I believe this is technically wrong;
> > 
> > To reflect the code, it should be changed to something like:
> > 
> > 	/* cacosh(z) = acosh(x +/- i y) = +/- i acos(x + i y) */
> 
> Sorry (fat fingers or worse):
> 
>  	/* cacosh(z) = acosh(x +/- i y) = +/- i acos(x +/- i y) */
> 

according to section 6.2 of

https://cs.uwaterloo.ca/~smwatt/pub/reprints/2000-sigsam-according.pdf

  acosh(z) = +-i acos(z)

with + when Im(z)>0 or Im(z)==0 && Re(z)<=1

i guess the Im(z)==+0 && Re(z)>1 case is tricky with ieee -0.0 as it
depends on if sqrt(-z) is i or -i for z=1, which depends on if pure
reals are treated specially sqrt(-1)==i or as sqrt(-1-0i)==-i, in the
latter case the current code looks right to me, just the comment wrong.


> Thanks - Damian
> 
> Pacific Engineering Systems International ..... 20D Grose St, 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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.