Hi,

As an experiment, I am trying to port a virtual machine written in
Java to Android platform. However, it heavily uses some special
floating point functions, like getting the exponent, or multiplying a
floating point by a power of 2. These are done with new Java Math
functions scalb and getExponent. It appears that they can be done by
manipulating the binary representation of the floating points.
However, because these functions don't seem to be available on Android
yet (are they?), all I could think of is implementing them with other
functions, like

public static float scalb(float f, int scaleFactor) {
  return f * Math.pow(2, scaleFactor);
}

public static int getExponent(float f) {
  return (int) (Math.log(f)/Math.log(2));
}

The question is... if the library doesn't have stock scalb and
getExponent functions, but the code is compiled with a new Java SDK
supporting the new math functions, could the Java compiler still
figure out a way to optimize these functions and operate on the binary
numeric level?

Thanks,
Danke

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to