Quote:
Originally Posted by Ether
I'll toss this out to stir up the pot: if you need double precision floats for your FRC software, you should re-think what you're doing.
|
The problem is you can define a variable as double and it is stored in memory as a double however the math is done as single precision. No warnings from the compiler or anything that would tell you this is happening.
Main reason this was an issue was that I was using doubles to do GPS lat/longitude calculations and it was being rounded/truncated which was causing accuracy issue.
To fix this, I stored the GPS lat/long x 10^7 as a 32 bit integer and take the difference with integer math and do the rest in floating point.
Another place this may be useful is gyro integration and the offset. However single precision works fine.