mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: mg1633068 <songyue@smail.nju.edu.cn>
Cc: musl <musl@lists.openwall.com>
Subject: Re: [musl] casinh function accuracy problem
Date: Tue, 11 Feb 2020 20:30:59 +0100	[thread overview]
Message-ID: <20200211193059.GH23985@port70.net> (raw)
In-Reply-To: <tencent_3FE6CDED4F8BDB5D27463C26@qq.com>

* mg1633068 <songyue@smail.nju.edu.cn> [2020-02-11 23:51:51 +0800]:
> Hi everyone,
> I'm writing testcases for complex math function. Considering the following simple code
> 
> #include <stdio.h>
> #include <complex.h>
> int main(int argc, char *argv[])
> {
>     double complex d = 3.0+6.6*I;
>     double complex ret = casinh(d);
>     printf("casinh(3.0+6.6*I)=%.15f+%.15f*I\n", creal(ret), cimag(ret));
> 
>     return 0;
> }
> 
> With musl libc, the result is:
>     casinh(3.0+6.6*I)=2.671002221994648+1.140551372972568*I
> but with glibc, the result is:
>     casinh(3.0+6.6*I)=2.671002221994652+1.140551372972565*I
> 
> We can see that musl is less accurate. I'm trying to solve this problem.
> With little knowledge of numerical computing, any comment is appreciated!

do you mean you are trying to fix the code in musl?

that's welcome, but i think it will be hard without
numerical computing knowledge.

several complex math functions in musl are not
correct (implemented in a very naive way), but
fixing them is significant effort.

in this particular case the 8 and 12 ulp errors
on the real and imaginary parts are still
considered small errors (glibc has 1 and 2 ulp
errors compared to the correctly rounded result).

  reply	other threads:[~2020-02-11 19:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11 15:51 mg1633068
2020-02-11 19:30 ` Szabolcs Nagy [this message]
2020-02-11 23:24   ` Rich Felker
2020-02-12  0:46     ` Damian McGuckin
2020-02-12  2:00       ` Rich Felker
2020-02-12  4:07         ` Damian McGuckin
2020-02-12  4:19           ` 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=20200211193059.GH23985@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    --cc=songyue@smail.nju.edu.cn \
    /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).