inverse sine in j2me midp1.0

Started by
3 comments, last by werekarg 19 years, 1 month ago
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.
Advertisement
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
hi, where'd you get the fplib? my fplib doesn't have asin in it...:(
I just googled for 'fplib' and it was the first page found.

Skizz
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]);

This topic is closed to new replies.

Advertisement