Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Stanacar, StefanX" <stefanx.stanacar@intel.com>
To: "Mats.Karrman@tritech.se" <Mats.Karrman@tritech.se>
Cc: "openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>
Subject: Re: libm accuracy, eglibc compared to glibc
Date: Wed, 12 Mar 2014 15:43:47 +0000	[thread overview]
Message-ID: <1394639041.18740.8.camel@firebird.rb.intel.com> (raw)
In-Reply-To: <ED3E0BCACD909541BA94A34C4A164D4C5B18163B@post.tritech.se>


Hello,

I just want to point out that this looks very similar to a qemuppc
machine bug we've seen before with libm and floor() call:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=4854

It was fixed with:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=2a48e9007cc92fedfdb6919411859fb943eacc94

HTH,
Stefan

On Wed, 2014-03-12 at 15:30 +0000, Mats Kärrman wrote:
> Hi,
> 
> I face a problem with libm. With my Dora build the following assertion doesn't hold:
> 
> sqrt( pow( sqrt( 2.0 ), 4.0 ) ) == 2.0
> 
> 1) With my old OE-classic / glibc-2.9 / PowerPC-hf it holds.
> 2) With my Debian desktop PC / glibc-2.17 / amd64 it holds.
> 3) With my new OE-core Dora / eglibc-2.18 / PowerPC-hf it doesn't hold.
> 
> Close enough one can think but the standardized test case I run requires the result to be 2.0.
> A simple test program:
> --------------------------------------------------------------------
> #include <stdio.h>
> #include <math.h>
> 
> int main(){
> 
> 	double two = 2.0;
> 	double four = 4.0;
> 
> 	double s1 = sqrt(two);
> 	printf("sqrt(%.20f) = %.20f\n", two, s1);
> 	double p   = pow(s1, four);
> 	printf("pow(%.20f, %.20f) = %.20f\n", s1, four, p);
> 	double s2 = sqrt(p);
> 	printf("sqrt(%.20f) = %.20f\n", p, s2);
> 
> }
> --------------------------------------------------------------------
> 
> results from 1 and 2 (identical):
> sqrt(2.00000000000000000000) = 1.41421356237309514547
> pow(1.41421356237309514547, 4.00000000000000000000) = 4.00000000000000088818
> sqrt(4.00000000000000088818) = 2.00000000000000000000
> 
> results from 3:
> sqrt(2.00000000000000000000) = 1.41421356237309492343
> pow(1.41421356237309492343, 4.00000000000000000000) = 3.99999999999999866773
> sqrt(3.99999999999999866773) = 1.99999999999999955591
> 
> Does anyone know if this is a known "feature" of eglibc or know any other reason
> for this difference?
> 
> Best Regards,
> Mats


  reply	other threads:[~2014-03-12 15:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 15:30 libm accuracy, eglibc compared to glibc Mats Kärrman
2014-03-12 15:43 ` Stanacar, StefanX [this message]
2014-03-12 15:58 ` Burton, Ross
2014-03-13  7:45   ` Mats Kärrman
2014-03-12 17:37 ` Phil Blundell
2014-03-13  7:46   ` Mats Kärrman
2014-03-13 10:36   ` Mats Kärrman
2014-03-12 18:09 ` Khem Raj
2014-03-13  7:51   ` Mats Kärrman

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=1394639041.18740.8.camel@firebird.rb.intel.com \
    --to=stefanx.stanacar@intel.com \
    --cc=Mats.Karrman@tritech.se \
    --cc=openembedded-core@lists.openembedded.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox