octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: yet another Java oddity


From: John W. Eaton
Subject: Re: yet another Java oddity
Date: Thu, 07 Feb 2013 10:32:10 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121122 Icedove/10.0.11

On 02/07/2013 10:25 AM, Mike Miller wrote:
On Thu, Feb 7, 2013 at 9:24 AM, John W. Eaton wrote:
On 02/07/2013 09:15 AM, Mike Miller wrote:

The tests that are failing for me are chop, axis, betainv, normpdf, and
dec2base. I looked into them enough that I believe all of them are
failing because the value returned by std::pow is different when Java is
running.

EDIT: I contradicted myself here. I believe the chop, betainv, and
normpdf tests are failing due to std::pow. Dec2base fails because of
the subtraction example I showed above truncating the number of
significant bits. I am not sure about axis.

It certainly does seem strange that std::pow would return a different value
after Java is loaded.  I don't know how that could happen.  Can you use gdb
and set a breakpoint in std::pow and then step through it to see what
happens in both cases?

Yes, I had done this yesterday and didn't want to flood with too many
details at once. Here's a transcript.

octave:1>  10^-5

Breakpoint 1, __pow (x=10, y=-5) at w_pow.c:29
29      {
(gdb) n
34              z=__ieee754_pow(x,y);
(gdb) s
__ieee754_pow () at ../sysdeps/i386/fpu/e_pow.S:66
66              fldl    12(%esp)        // y
(gdb) finish
Run till exit from #0  __ieee754_pow () at ../sysdeps/i386/fpu/e_pow.S:66
__pow (x=10, y=-5) at w_pow.c:35
35              if(_LIB_VERSION == _IEEE_|| __isnan(y)) return z;
(gdb) finish
Run till exit from #0  __pow (x=10, y=-5) at w_pow.c:35
xpow (a=10, b=-5) at ../../default/libinterp/interp-core/xpow.cc:95
95        return retval;
Value returned is $1 = 1.0000000000000001e-05
(gdb) cont
Continuing.
ans =  1.0000e-05
octave:2>  javaObject ("java.lang.String");
[New Thread 0xa4ba8b70 (LWP 660)]
[New Thread 0xa4b28b70 (LWP 661)]
[New Thread 0xa4aa8b70 (LWP 662)]
[New Thread 0xa4a28b70 (LWP 663)]
[New Thread 0xa466eb70 (LWP 664)]
[New Thread 0xa45eeb70 (LWP 665)]
[New Thread 0xa4975b70 (LWP 666)]
[New Thread 0xa459eb70 (LWP 667)]
[New Thread 0xa454eb70 (LWP 668)]
[New Thread 0xa44ceb70 (LWP 669)]
[New Thread 0xa444eb70 (LWP 670)]
[New Thread 0xa43feb70 (LWP 671)]
octave:3>  10^-5

Breakpoint 1, __pow (x=10, y=-5) at w_pow.c:29
29      {
(gdb) n
34              z=__ieee754_pow(x,y);
(gdb) s
__ieee754_pow () at ../sysdeps/i386/fpu/e_pow.S:66
66              fldl    12(%esp)        // y
(gdb) finish
Run till exit from #0  __ieee754_pow () at ../sysdeps/i386/fpu/e_pow.S:66
__pow (x=10, y=-5) at w_pow.c:35
35              if(_LIB_VERSION == _IEEE_|| __isnan(y)) return z;
(gdb) finish
Run till exit from #0  __pow (x=10, y=-5) at w_pow.c:35
xpow (a=10, b=-5) at ../../default/libinterp/interp-core/xpow.cc:95
95        return retval;
Value returned is $2 = 1.0000000000000006e-05
(gdb) cont
Continuing.
ans =  1.0000e-05

Looks to me like the same call stack with different return values.

That's odd. Does the JVM set some FPU flags that are different from the default that could affect the values that std::pow computes?

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]