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

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


Sponsored Links
 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

--



Other Threads

1. EditText background text

Hi!
Is there a way to set the background text of an EditText? for
instance, I have a login screen with 2 EditText views, one for
username and one for password. I want the text "Username" and
"Password" be written inside the EditText, and once the user touches
those the text disappears but once user deleted his own entry, text re-
appears.

Is there a property for that or should I implement this on my own with
events and stuff?

-- 

2. Incoming call Activity

Hello All,

Maby someone can address this issue:

I have an activity that are activated on incoming call. the activity
have a LinearLayout with ImageView
and a Theme.Translucent.NoTitleBar. I wanna make the beneath call
screen receive event's ?
i can only receive events in the beneath call screen only when
removing my activity.

anyone can help ?

-- 

3. Eclipse ADT 8.0.0 (and 8.0.1) problem - can't create views hierarchy with drag and drop in the Outline view

4. Join Our Group

5. timed_gpio Driver Functional Description

6. Webservice calling problem with complex data type

7. DRM protection for multimedia/book contents in Android.