I am trying to get a gps reading from a string in a float on my Arduino. The line everything handles all the digits just fine, but when I divide it to get a float, I lose 4 of my digits. Here is my code:
gpsStrings[0].replace(".", ""); lat = gpsRawData[0].toFloat(); lat = lat / 1000000.0;
Using .toFloat for a string that still has a decimal point results in only two numbers after the decimal point.
Examples of numbers:
42427898 :: 42.43 - what happens 42427898 :: 42.427898 - what I want to happen
source share