[OE-core] libm accuracy, eglibc compared to glibc

Khem Raj raj.khem at gmail.com
Wed Mar 12 18:09:20 UTC 2014


Hi Mats

On Wed, Mar 12, 2014 at 8:30 AM, Mats Kärrman <Mats.Karrman at tritech.se> 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?
>
We have done changes since OE-Classic days in the FPU area for ppc.
what ppc machine is it ? I have access to p2020 based machine (e500v2)
and it works as expected with
dora/eglibc-2.18

> Best Regards,
> Mats
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core



More information about the Openembedded-core mailing list