# inverse sine in j2me midp1.0

This topic is 5066 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

how does one calculate the inverse sine (arcsin) in j2me midp1.0? i have fplib that does floating point and calculates sine of an angle, i don't know how to make it to inverse sine. please help. thanks.

##### Share on other sites
First off, MIDP1.0 (or rather, CLDC1.0) does not support floating point functions, so any floating point library will be implementing all the floating point operations in software, which will be slow.

I've just looked at the fplib stuff and it's actually using 16:16 fixed point format. The library I've just looked at has an asin function.

If the library you're using doesn't have an asin (i.e. a different fplib) then the choices are either a polynomial expansion or a lookup table.

Skizz

##### Share on other sites
hi, where'd you get the fplib? my fplib doesn't have asin in it...:(

##### Share on other sites
I just googled for 'fplib' and it was the first page found.

Skizz

##### Share on other sites
precompute:
- either put the values in a int[] ASinTable (takes lots of jar space)
- generate the table with an external tool (a C++ program for example) and load it into you midlet with an InputStream
- generate the table using series (as in http://mathworld.wolfram.com/InverseSine.html, see bottom of the page, the maclaurin series)

real-time:
- use the maclaurin series (or other numerical methods) - slower

since arcsin goes into a definition interval of [0..1] (as teh function is symetrical to the origin), then you will probably need to go with an interval like [0..1023] or more/less depending on the precision you need ( as in ASinTAble = new int[1024]);

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 17
• 14
• 10
• 9
• 11
• ### Forum Statistics

• Total Topics
634094
• Total Posts
3015498
×