Jump to content
  • Advertisement
Sign in to follow this  
_nomad_

inverse sine in j2me midp1.0

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
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

Share this post


Link to post
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]);

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!