Trig functions returning bogus results

Discussion in 'Questions (Windows Mobile)' started by focusrocker, Sep 7, 2009.

  1. focusrocker

    focusrocker Member

    I am having trouble with trig function.

    my code:

    result = atan(1)

    the msgbox returns a result value of 0.785.....

    result should = 45.
    I have tested other trig functions, and all result seem off.

    what i am doing wrong?
  2. Erel

    Erel Administrator Staff Member Licensed User

    These functions expect radians or return radians rather than degrees.
    So your code should be:
    resultInDegrees = 180 / cpi * atan(1)
    Another example:
    result = Sin(45 * cPI / 180)
    msgbox(result) '0.707 = Sqrt(2)/2
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice