Shop OBEX P1 Docs P2 Docs Learn Events
Using Two''s complement math for SIN and COS — Parallax Forums

Using Two''s complement math for SIN and COS

ArchiverArchiver Posts: 46,084
edited 2002-08-08 19:36 in General Discussion
One part of my dead reackoning navigation project involves a vector
solution of position based on a Lat/Long position, heading and
distance traveled.

Because I don't really understand how to perform multiply and divide
operations using two's complement values (which are the form SIN and
COS come in BS2SX), I have some very messy code (which is
contributing to a lack of eeprom) to deal with heading directions
where sin and/or cos return a negative value.

Does anyone have any example code or a good reference to explain how
to handle SIN and COS in the STAMP. The manual explains the bit
inversion with add of 1, for negative values, but that doesn't really
help me.
Sign In or Register to comment.