According to the Atom Pro manual, the type float is good from ± 2^-126 to ± 2^127 and FCOS and FSIN is good from -pi/2 to pi/2 (actual is ± 1.74 radians). So I believe what I’m asking it to do is reasonable…
Is it because “1.0471975511965977461542144610932” (60 degrees) is being truncated in the BasicAtom-Pro IDE when converting it to binary during compile?
I have not played around much with floating point on the Pro, but a quick look at the manual shows the format of the floating point number:
ATOM PRO format:
Bits 31 – 24 exponent (E)
Bit 23 sign bit (S)
Bits 22 – 0 mantissa (M)
From this you can see that the Atom Pro (and similarly ieee format) has only 23 binary bits of data for the mantissa. Which for sure is not enough to hold your number: (.10471975511965977461542144610932) to the 33 decimal digits accuracy… My guess is that 23 bits of data might give you decimal accuracy to 7 or 8 digits, but my math is a bit rusty…
ya know these are single-precision floating point numbers running on a hitachi microcontroller and taking less than a second to return a computation… I just don’t get what the issue is… sudden realization that not all floating point calculations are equal? <- confused
Try looking at page 66 document numbering (76 pdf numbering). Or do a search for “floating point format” or “IEEE”
P.S. - I agree with Eddie, that you may be asking for too much if you want more than 7 or 8 digits of accuracy from a microcontroller doing floating point calculations such as FSIN with no underlying hardware support…