NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
re: port-sparc64/47834: 128 bit softfloat scalbnl broken
The following reply was made to PR port-sparc64/47834; it has been noted by
GNATS.
From: matthew green <mrg%eterna.com.au@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: port-sparc64-maintainer%netbsd.org@localhost,
gnats-admin%netbsd.org@localhost,
netbsd-bugs%netbsd.org@localhost
Subject: re: port-sparc64/47834: 128 bit softfloat scalbnl broken
Date: Sun, 19 May 2013 15:48:56 +1000
your test program isn't entirely correct.
> Running the below test program (natively compiled on sparc64) reports
> different, but all wrong numeric results depending on the optimization
> level used.
>
> With -O0 it says:
> 0 (should be: 1.00085)
this is bad.
> Letting the compiler pre-compute it with -O2 it says:
> 2.0017 (should be: 1.00085)
this result is correct. FLT_RADIX is 2, and:
DESCRIPTION
The scalbn(), scalbnf(), and scalbnl() functions compute x * r^n, where r
is the radix of the machine's floating point arithmetic, defined by the
FLT_RADIX constant in <float.h>. The rationale is efficiency; r^n is not
ie, we have: 1.00085 * 2^1 => 2.0017.
> >How-To-Repeat:
> Natively compile this program (with -lm) on sparc64:
>
> #include <math.h>
> #include <stdio.h>
>
> int main(int argc, char **argv)
> {
> long double val = 1.00085;
> long double res = scalbnl(val, 1);
>
> printf("%Lg (should be: %Lg)\n", res, val);
>
> return 0;
> }
.mrg.
Home |
Main Index |
Thread Index |
Old Index