Results 1 to 2 of 2
Like Tree2Likes
  • 2 Post By MemoNick

Thread: Sin() Wrong Results

  1. #1
    MemoNick is offline Member
    Join Date
    Nov 2011
    Posts
    11
    Rep Power
    0

    Default Sin() Wrong Results

    I have the following java snippet:

    zMove = Math.sin(rotationN);

    zMove is a double, while rotationN is an integer.

    The problem arises in the calculation. When rotationN is 30, the result should be 0.5. However, the output is -0.9880316240928618. What am I doing wrong, and what should I change? Thanks in advance.

    EDIT: Solved. Apparently, it was working in Radians. Please, Mods, do not delete this post. Maybe someone with the same problem sees this. Thanks.
    Last edited by MemoNick; 12-07-2011 at 09:34 AM.
    DarrylBurke and Fubarable like this.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Moderator
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    10,089
    Rep Power
    17

    Default Re: Sin() Wrong Results

    This is a perfect example of why it's important to read the API documentation for the classes and methods used.

    db
    Why do they call it rush hour when nothing moves? - Robin Williams

Similar Threads

  1. Replies: 4
    Last Post: 06-11-2013, 01:37 AM
  2. wrong results with recursion
    By sara12345 in forum New To Java
    Replies: 0
    Last Post: 04-12-2010, 04:49 PM
  3. Wrong Numeric Results with Right Math Implementation.
    By Übermenschen in forum Advanced Java
    Replies: 4
    Last Post: 04-02-2010, 02:52 AM
  4. Sometimes get the right results sometimes dont
    By Battlefeldt in forum New To Java
    Replies: 0
    Last Post: 12-18-2009, 01:03 AM
  5. InsertionSort My SourceCode - wrong results
    By JohnF8FJohn in forum New To Java
    Replies: 1
    Last Post: 11-27-2008, 01:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •