Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Nov 2019 21:51:38 +0000
From:      bugzilla-noreply@freebsd.org
To:        numerics@FreeBSD.org
Subject:   [Bug 237800] pow(3) returns inaccurate results
Message-ID:  <bug-237800-18636-AIA3RCCvRn@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-237800-18636@https.bugs.freebsd.org/bugzilla/>
References:  <bug-237800-18636@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D237800

--- Comment #14 from Steve Kargl <kargl@FreeBSD.org> ---
(In reply to me from comment #13)
>
> The test case I have at the moment is 0.6840442338072671 ** 2.4.
> As I understand it, it should be 0.4019777798321958 but I am
> getting 0.40197777983219574.

The first number contains 16 digits. The second contains
17 digits, so cannot make a judgement on rounding.  But,

% ./testd -a 0.6840442338072671 2.4
libm =3D  4.0197777983219574e-01, /* 0x3fd9ba01, 0x02864520 */
mpfr =3D  4.0197777983219579e-01, /* 0x3fd9ba01, 0x02864521 */
 ulp =3D 0.51122

MPFR is an arbitrary precision library where I have it set
to use 212 bits of precision to compute pow().  pow() is
FreeBSD's libm value with 53-bits of precision.  You have
a ULP of 0.51122.  That is about as accurate as one might
expect.

See comment #8 for a pointer to Goldberg's paper.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-237800-18636-AIA3RCCvRn>