Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Raiden
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

BB hasn't ASIN, ACON, ATAN

Hello guys
Black Berry JDE hasn't some trigonometrical functions. For example : asin (arc sine), atan (arc tangent) .. etc.
I need to calculate asin(x). But I don't know how ?
How to solve this action ?

Plz help me. I need ur support a lot.
Tnx'
Please use plain text.
Developer
Posts: 62
Registered: ‎07-14-2008
My Device: Not Specified

Re: BB hasn't ASIN, ACON, ATAN

I've posted that some times ago on the old BB forum:

 

This might work. Was used long time ago in OpenOffice:

Function ArcSin( x )
ArcSin = Atn( x / Sqr(-x * x + 1) )
End Function

Function ArcCos( x )
ArcCos = ArcSin( Sqr( 1 - x^2 ) )
End Function

Next problem is that there is no atan in the API...
Found that in wikipedia:

if abs(x) <= 1:
atan(x) = x/(x+0.28 * x^2)
if x > 1:
atan(x) = PI/2 - x/(x^2 + 0.28)

according to wiki is the max calc. difference under 0,005 Rad

Please use plain text.