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
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