> Are you asking whether the JVM will actually use certain particular
>CPU/FPU instructions when executing your code, or are you asking if there
>exists an API which can perform the equivalent of the above mentioned
>function, without regards as to what instructions the CPU/FPU will actually
>execute to implement those functions?
I'm a little drunk but the first that you said, Oliver,
>JVM will actually use certain particular
>CPU/FPU instructions
Thanks,
sorry if wasn't clear
EJP - 03 May 2006 12:10 GMT
> I'm a little drunk but the first that you said, Oliver,
OK well that's not a question about what the JVM *supports*, it's a
question about what the JVM *uses*, isn't it?
The answer to that can only be another couple of questions: *which* JVM,
*which* CPU?
In general, a hint as to the answer is right there in java.lang.Math:
'By default many of the Math methods simply call the equivalent method
in StrictMath for their implementation. Code generators are encouraged
to use platform-specific native libraries or microprocessor
instructions, where available, to provide higher-performance
implementations of Math methods. Such higher-performance implementations
still must conform to the specification for Math.'
Dimitri Ognibene - 03 May 2006 12:20 GMT
ok, so?
how can i know if the jdk 1.6 or 1.5 for linux and windows uses fpu
instructions? and which one it uses? I've googled around but I'couldn't
find anything clear.. Must I use a debugger to dicover it?
Thanks
Dimitri
Timo Stamm - 03 May 2006 12:47 GMT
Dimitri Ognibene schrieb:
> ok, so?
> how can i know if the jdk 1.6 or 1.5 for linux and windows uses fpu
> instructions? and which one it uses? I've googled around but I'couldn't
> find anything clear.. Must I use a debugger to dicover it?
The JSE uses StrictMath, which calles native code. So it depends on the
JVM implementation what happens.
You can download the source of the JVM and look how it's implemented.
(Carefully read the licence first.)
Timo
Dimitri Ognibene - 03 May 2006 12:54 GMT
ok i'll try this,
Thanks
Dimitri
Chris Uppal - 03 May 2006 13:37 GMT
> how can i know if the jdk 1.6 or 1.5 for linux and windows uses fpu
> instructions? and which one it uses? I've googled around but I'couldn't
> find anything clear.. Must I use a debugger to dicover it?
You can probably find out exactly what code is used by using JVMTI, but I've
never done that myself, so I can't say how easy or difficult it would be (my
guess is that it's pretty tricky).
Also, you may find this link relevant:
http://blogs.sun.com/roller/page/jag?entry=transcendental_meditation
James Gosling writing about the implementation of transcendental functions in
Java.
-- chris