String to Float conversion issue

I am attempting to read a value from a file on an SD card, which ultimately need to end up as a float, so i can do some math with it. I am not having any issues getting the value from the sd card as a string (or really an array of chars), but when i attempt attempt to convert that to a float i am losing the 3rd decimal place on. The file on the SD card has: 37.639693 in it

Here’s my code:

#include <SD.h>
const int chipSelect = 10;

File targetFile;
float targetLat ;
char FileData[10];

void setup()
   pinMode(10, OUTPUT);
      // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    targetFile ="target.txt");
    byte index = 0;
    //if the file is open...
    if (targetFile){
      //keep reading chars till there are no more
    while (targetFile.available()){
      FileData[index] =;
      //Filedata has a char array representation of a float.
    targetLat = atof(FileData);

void loop(){

 delay (20000);

And here is the output from the code:


I have also tried using “strtod” with the same results. Any idea how i can get my float value with precision I am looking for?



Floats are similarly printed as ASCII digits, defaulting to two decimal places.

An optional second parameter specifies the base (format) to use; permitted values are BIN (binary, or base 2), OCT (octal, or base 8 ), DEC (decimal, or base 10), HEX (hexadecimal, or base 16). For floating point numbers, this parameter specifies the number of decimal places to use.

Thanks! I was looking at it from a data problem not a display problem. I knew it was something simple that I was overlooking! XD

Thanks again, Steve