I am trying to get accurate precision with sin and cosine.
eg my angle is:
50.401687 degrees (generated by GPS chip)
If I set this up as a float it seems to truncate it to 50.40 (when I do Serial.print(x)
Is there any way of keeping numbers accurate to 6 decimal places on the Arduino UNO?
I want to perform sin and cosine (and acos atan2 etc) with as much accuracy as possible.
Grateful for any advice.
If I set this up as a float it seems to truncate it to 50.40 (when I do Serial.print(x)
Is there any way of keeping numbers accurate to 6 decimal places on the Arduino UNO?
External (printed) accuracy and internal accuracy are not the same thing. Pay attention to the Serial.print() method overloads - specifically the one for floats. You CAN change the number of digits printed after the decimal point.
You can NOT change the stored accuracy, though, so don't bother trying to print more than 6 decimal places and expect them to mean anything.