Can somebody help me make this Float!
Sniper King
Posts: 221
This is an enhanced PID loop for autonomous control stuff.· It would be nice if the whole thing worked in the realm of floating point math to make it much more accurate.· I need to see how to make my variables into floating math and then use them in the code I have supplied.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·- Ouch, thats not suppose to be hot!··
Michael King
Application Engineer
R&D
Digital Technology Group
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·- Ouch, thats not suppose to be hot!··
Michael King
Application Engineer
R&D
Digital Technology Group
Comments
http://forums.parallax.com/forums/default.aspx?f=25&m=277320&g=277621#m277621
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·- Ouch, thats not suppose to be hot!··
Michael King
Application Engineer
R&D
Digital Technology Group
Let's say your number is '1234'. You could do:
Now let's say your stuff was in a fixed point format. Something like '12.34' represented as '1234'.
Remember that the spin compiler will automatically convert floating point constants to IEEE 754 format.
Can I say...
fp.FFloat(32.5)·is the changed value.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·- Ouch, thats not suppose to be hot!··
Michael King
Application Engineer
R&D
Digital Technology Group
Post Edited (Sniper King) : 8/20/2008 5:05:11 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://forums.parallax.com/showthread.php?p=650217
meow, i have my own topic now? (sorta)
Just do 'myfloat := 23.5'. The spin compiler will automatically convert all constant floats to the correct format. If you want to force the compiler to do some constant float evaluation you can use float().
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://forums.parallax.com/showthread.php?p=650217
meow, i have my own topic now? (sorta)
Theres no way of getting around it, other than assigning floating point constants, you must include some form of floating point library. The Propeller does not have the capability of natively handling floating point mathmatical operations.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 8/20/2008 10:29:52 PM GMT