Hello everyone, I have the following string: "4238.27191"
I then convert it to a character array which reads: "4238.27191"
Now when I convert to a float, I read: "4238.27"
When I divide that number by 100 (to move the decimal), I read: "42.38"
I need to retain at least seven digits, why am I only outputting four? Double float did not work..
I can live with the standard float output, but why does the division operator output only five characters? four digits of precision?
Is there any way to move the decimal without loosing so much precision?
Maybe I am way off of the ball in my code..
String GPSLatInA = ""; // Current GPS Latitude String GPSLonInA = ""; // Current GPS Longitude char GPSLatInB; // Current GPS Latitude char GPSLonInB; // Current GPS Longitude float GPSLatInC; // Current GPS Latitude float GPSLonInC; // Current GPS Longitude . . . case 3: GPSLatInA = ( GPSBuffer.substring(0,DelimiterPosition)); GPSLatInA.toCharArray(GPSLatInB, GPSLatInA.length()+1); GPSLatInC = atof(GPSLatInB); GPSLatInC = (GPSLatInC/(100.000)); break; case 5: GPSLonInA = ( GPSBuffer.substring(0,DelimiterPosition)); GPSLonInA.toCharArray(GPSLonInB, GPSLonInA.length()+1); GPSLonInC = atof(GPSLonInB); GPSLonInC = (GPSLonInC/(100.000)); break;
Do you guys know of any clever stdlib.h functions that will allow me to retain my original string as integers?