I just started profiling an application that does some log linear
interpolation, and I noticed something strange when calling Math.log
and Math.exp
inside each other. The behaviour can be reproduced the following way:
public class TestLogExp {
public static void main(String[] args) {
Double thisdouble = 0d;
thisdouble = Math.log(Math.exp(10));
System.out.println(thisdouble);
}
}
Now we clearly see that Math.log
and Math.exp
are called within this main method. However, when I put a breakpoint in both Math.exp
and Math.log
(which are just calls to StrictMath
native statics
), the execution is only interrupted in Math.exp
, not in Math.log
.
Now I thought it could be that java
does not debug calls within calls from static methods, but when I call Math.exp(Math.log(10))
(so the other way around), the same behaviour is observed, only stopping in exp, not in log...
Anybody able to reproduce this? Why is this happening?
EDIT: It seems like it's not debugging the Math.log function at all. Replace the line thisdouble = Math.log(Math.exp(10));
with thisdouble = Math.log(10);
, and still not stopping in debug mode, although there's a breakpoint in Math.class...
It does go into both the methods if you try it this way:
Double thisdouble = 0d;
double temp = Math.exp(10);
thisdouble = Math.log(temp);
System.out.println(thisdouble);
I am using Netbeans v7.3
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.