Re: mathlib pow gives bad result
Re: mathlib pow gives bad result
- Subject: Re: mathlib pow gives bad result
- From: Markus Weissmann <email@hidden>
- Date: Fri, 19 May 2006 14:05:05 +0200
On Fri, 2006-05-19 at 06:56 -0400, email@hidden wrote:
> Dear Darwin developers,
>
> I've discovered that my program works differently on PowerPC running Mac OS
> X 10.4.6 and Itanium2 running HP-
> UX. The problem appears to be in the pow function which gives result that
> differs by 12 ulps from Itanium2.
>
> PowerPC-Mac OS X double: 0.44921455671723881 (gdb> print val)
> Itanium2-HP UX double: 0.44921455671723876 (gdb> print val)
> Mathematica (PowerPC-double): 0.44921455671723886 649004953142139
> (N[val,32])
> Mathematica (Pentium4-double): 0.44921455671723875 546774706890574
> (N[val,32])
> Mathematica (rational evaluation): 0.44921455671723877 615723308414713
> (N[val,32])
>
> Itanium2 is obviously closer to the proper result. Should I file a bug
> against libm?
>
If Itanium2 does x86 floating point arithmetic, keep in mind that x86
operates on 80 bit floats internally, while ppc (afaik) does "only" work
with the given 64 bit.
So this probably is an architecture issue. You could try and compare
this to linux/ppc results (via a ppc/linux live-cd perhaps). If
precision is a general problem for you, you might try some software
implemented multi-precision floating point numbers, e. g. gmp [1].
-Markus
[1] http://www.swox.com/gmp/
--
http://www.mweissmann.de/
http://www.opendarwin.org/~mww/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden