I’ve found myself in a bit of a pickle. I need to write a calculation that involves some inverse trig for our robot, and the embedded version of Java that the cRIO uses (Java ME) does not have the inverse trig functions of the Java SE Math library.
Depending on how you intend to use the trig function, another option is to write a simple routine that gives an approximate but “close enough” answer.
For example, our robot uses a leadscrew to adjust the tilt angle of our climbing mast. There is an encoder attached to the end of the leadscrew so we can measure the distance it has traveled and use the cosine rule to convert this to an angle for the drivers. However to convert from leadscrew distance to angle requires using the acos() function.
Since the range of leadscrew distances are limited by the physical system, our programmers approximated the function using a piecewise linear approximation implemented as a lookup table. While the results are approximate they are close enough for visual display.
This approach is fairly common practice in embedded software, and can be used safely if you do proper error analysis.