string to float
s2jesse
Posts: 62
Is there a simple object etc or a simple meathod to do· a string to float...
I've used fromString etc but it doenst seem to work with my float math
As a simple example im taking the knots string·from my gps·and converting it to mph but i cant seem to get a float im guesing it is only converting it out to an int.
Thanks Sorry for my continued newbness...
Jesse
·
I've used fromString etc but it doenst seem to work with my float math
As a simple example im taking the knots string·from my gps·and converting it to mph but i cant seem to get a float im guesing it is only converting it out to an int.
Thanks Sorry for my continued newbness...
Jesse
·
Comments
Thanks
Jesse
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ D Rat
Dave Ratcliff· N6YEE
k is a string like 0.14 (ive checked it)
m is always· coming through as "··· 0.0"
if i manually set k to something like··· ·k := 4.5 it works
the result works.· Im having hard time grasping the simple basics of how these variables work. i dont get how the prop stores a float in a long vs a string etc.
Post Edited (s2jesse) : 7/23/2008 5:13:27 AM GMT
http://en.wikipedia.org/wiki/IEEE_754
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
Hrm well it is clearer to me that I do need to convert the string the gps object is returning to a float.
Ive used numbers.spin to convert to ints etc but i just don't see any usermade objects that will convert to float..
Any last insight before I dive in and poorly attempt to reinvent the wheel. [noparse]:)[/noparse]
here is a simple String to Float conversion:
This function supports no scientific format (i.e. 1.23e6), and max 9 decimal digits in the string.
Attached is a little Demo.
Andy
Post Edited (grasshopper) : 7/23/2008 5:05:19 PM GMT
basically that was the problem i needed to know how to make them both floating point... hence the question how do i convert a string to a float... but i think ariba has graciously supplied me with the answer / code... i have yet to try it out but when i can ill give it a shot... thanks all
yep thanks worked like a charm!