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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


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

Way to replace ASIN trigonometrical function

Hello guys'

I have a big proble. This is my application uses Math.asin() function. But BB hasn't 

functions that named asin(), acon(), atan(). I found function that calculate asin() approximately :

 

    public double arcSine(double a) {
       
        double x;
        double epsilon = 1.0E-7;
       
        x = a;
        do {
            x = x - (Math.sin(x)-a)/Math.cos(x);
        } while(Math.abs(Math.sin(x)-a) <= epsilon);
        return x;
    }

 

But its difference is too a lot of. For example 0.02693011603811.

I need difference at least :  0.000000001

 

Have u any best solution ?

 

Plz help me guys.

Tnx again.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Way to replace ASIN trigonometrical function

Haven't tried it myself, but have you seen the code in this thread?

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=142

(you can also find it by searching for ASIN)

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

Re: Way to replace ASIN trigonometrical function

Yeap' I've seen this thread. I found a new function. Its difference : 0.000001

It's enough to calculate.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Way to replace ASIN trigonometrical function

Any chance of publishing your new function for other people who might want a more accurate value?

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

Re: Way to replace ASIN trigonometrical function

It's workin :

 

public double asinCalculation(double x) {
       
        double result = x + 0.16666666666666666666666666666667 * x * x * x
        + 0.075 * x * x * x * x * x
        + 0.044642857142857142857142857142857 * x * x * x * x * x * x
        * x + 0.030381944444444444444444444444444 * x * x * x * x * x
        * x * x * x * x + 0.022372159090909090909090909090909 * x * x
        * x * x * x * x * x * x * x * x * x
        + 0.017352764423076923076923076923077 * x * x * x * x * x * x
        * x * x * x * x * x * x * x + 0.01396484375 * x * x * x * x * x
        * x * x * x * x * x * x * x * x * x * x
        + 0.011551800896139705882352941176471 * x * x * x * x * x * x
        * x * x * x * x * x * x * x * x * x * x * x
        + 0.0097616095291940789473684210526316 * x * x * x * x * x * x
        * x * x * x * x * x * x * x * x * x * x * x * x * x
        + 0.0083903358096168154761904761904762 * x * x * x * x * x * x
        * x * x * x * x * x * x * x * x * x * x * x * x * x * x * x
        + 0.007312525873598845108695652173913 * x * x * x * x * x * x
        * x * x * x * x * x * x * x * x * x * x * x * x * x * x * x * x
        * x;
        return result;
    }