PIC floating point questions
Posted: Sun Nov 24, 2013 6:26 pm
Hi,
I have searched the forums and tested for hours and hours but I can't get this sorted so I need help
Doing some floating point calculations on a PIC18F26K80 and I need higher precision I think.
What I am trying to do, shown in below example:
X=C*Z
Y=((a1*X)+(a2(X^2))+(a3(X^3))+(a4(X^4))+(a5(X^5))+(a6(X^6))+(a7(X^7))+(a8(X^8))+(a9(X^9)))
Constants:
C: 0.041276
a1: 25.08355
a2: 0.07860106
a3: -0.2503131
a4: 0.0831527
a5: -0.01228034
a6: 0.0009804036
a7: -0.0000441303
a8: 0.000001057734
a9: -0.00000001052755
Variables:
X =
Y =
Z =
---------
So for Z=20 we will get:
X = 0.82552
Y = 19.627236792
Final value of Y could be presented with only two decimal points.
---------
Is there any way to do this on a 8bit PIC?
Thanks.
I have searched the forums and tested for hours and hours but I can't get this sorted so I need help

Doing some floating point calculations on a PIC18F26K80 and I need higher precision I think.
What I am trying to do, shown in below example:
X=C*Z
Y=((a1*X)+(a2(X^2))+(a3(X^3))+(a4(X^4))+(a5(X^5))+(a6(X^6))+(a7(X^7))+(a8(X^8))+(a9(X^9)))
Constants:
C: 0.041276
a1: 25.08355
a2: 0.07860106
a3: -0.2503131
a4: 0.0831527
a5: -0.01228034
a6: 0.0009804036
a7: -0.0000441303
a8: 0.000001057734
a9: -0.00000001052755
Variables:
X =
Y =
Z =
---------
So for Z=20 we will get:
X = 0.82552
Y = 19.627236792
Final value of Y could be presented with only two decimal points.
---------
Is there any way to do this on a 8bit PIC?
Thanks.