how to get the mathematical function sin


Results 1 to 10 of 10

Threaded View

  1. #4


    Did you find this post helpful? Yes | No

    Default a little experimentation

    Never mind, I discovered the answer with a little impromptu LCDing.

    What is unclear in the manual is that the angle in degrees is represented by a value of 0-255 instead of 0-359. It's NOT in radians as the manual suggests (where a decimal value of 6.28 radians would correspond to 360 degrees). To calculate the value to pass to the function SIN x, you have to use x=255y/360 where y was your angle in degrees.

    The result returned from the SIN function is in the range of 0-255, in two's compliment form (where 0-127 corresponds to a scaled sin result of 0.00 to 1.00 respectively and 128-255 corresponds to a scaled sin result of -1.00 to 0.00 respectively).

    Although it's not super accurate, it's reasonably adequate to 2 decimal places if you figure 0-127 scaling is better than 1 to 100.
    Last edited by picster; - 11th July 2010 at 16:45. Reason: clarity

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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