Testing the accuracy of the Sinus and Cosinus values, see elsewhere, I found some accuracy loss of floating point variables ONLY IN THE SIMULATION mode.
A macro can return a floating point variable. If used the accuracy *) will be changed to 0.000001 (absolute). Or said it in a different way, the return floating point value of a macro will be rounded to 6 numbers after the decimal point. This happens only in the simulation mode, not when a microcontroller is used.
Be prepared!
Jan Lichtenbelt
*) Note. I do not know the accuray of floating point variables. Floating point variables use 4 bytes. As far as I know, the last byte is used for the exponential part and sign, the other 3 bytes are used for the number after the decimal point. That means the accuracy of floating point variables is 2^24.
Lost variable accuracy in Simulation mode
Moderator: Benj
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Lost variable accuracy in Simulation mode
- Attachments
-
- Accuracy of floating macro value.fcf
- (8.5 KiB) Downloaded 253 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Lost variable accuracy in Simulation mode
Hello Jan,
The float variables are indeed 4-bytes. I think the simulation does differ slightly from the physical hardware where floating point numbers are involved though I do not know the cause of this. I've added it to the bugs list anyway for us to look at and try to solve.
The float variables are indeed 4-bytes. I think the simulation does differ slightly from the physical hardware where floating point numbers are involved though I do not know the cause of this. I've added it to the bugs list anyway for us to look at and try to solve.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel