Question: are Math.getExponent and Math.scalb supported on Android?

by Danke Xie » Thu, 12 Aug 2010 05:06:12 GMT

Sponsored Links

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?



Other Threads

1. Start laoding when scroll reaches end

Hey guys
I am parsing xml and i want that when the scroll is reached to the end
then the request to new data is handled.
For ex if the list is showing only 10 results and when i scrolled down
to the last result item ,then :-

1. how to show the "loading" view same as it is in market when we
search for applications and scroll down the loading text appears.

2. and then show the list of the result items appended to the existing

My approach till now :-
I have made a custom ScrollView and am printing the message when the
scroll reaches the end.
Now i want to show the "loading" text on activity screen when the
scroll reaches end.



2. Gingerbread update on Nexus One

Today I received on air update message (Gingerbread) to my Nexus One.
It was written that program needs to restart my phone which I
confirmed. But there was no update or any other changes after restart.

Was it a fake message? Is ther already Gingerbread update for Nexus
One? If there is, how can I update and activate?

Thanks in advance.


3. How To Reduce Camera Resolution?

4. MapView and large number of Overlay

5. Can we use AbstractCursor to support data changes?

6. NFC default app - thoughts?

7. OOT: Call dari "3"