lanternfish
Senior Member
Having searched hig and low in the forums, I am unable to find a good description for how to tackle double integer maths with the PICAXE.
The problem I have is converting radians to degrees. Now, the usual formula is: degrees = radians * 180 / pi. That part is easy.
In my application the radians component is a double integer (32 bits) with the following specs with a range of +-0 to pi/2 ( -1.5707963 to +1.5707963) and a resolution of 10-e8.
As the required resolution is only 10-e3, to convert radians to degrees:
(pi/2 x 10e3) * (180 x 10e3) / (pi x 10e3)
= 15708 * 1800000 / 31416
= 900000
= 900000 * 10-e3
= 90.0000
but 180 x 10e3 is greater than 16 bit resolution so how can I achieve the desired resolution?
Your help greatly appreciated.
The problem I have is converting radians to degrees. Now, the usual formula is: degrees = radians * 180 / pi. That part is easy.
In my application the radians component is a double integer (32 bits) with the following specs with a range of +-0 to pi/2 ( -1.5707963 to +1.5707963) and a resolution of 10-e8.
As the required resolution is only 10-e3, to convert radians to degrees:
(pi/2 x 10e3) * (180 x 10e3) / (pi x 10e3)
= 15708 * 1800000 / 31416
= 900000
= 900000 * 10-e3
= 90.0000
but 180 x 10e3 is greater than 16 bit resolution so how can I achieve the desired resolution?
Your help greatly appreciated.