Couple of quick questions...inf and reading data

Two little questions...
Is the output of inf for a division because the data is too small to display or out of the range of my doubles? Some work others (using the same calculation) save as inf.

And how can I read a file from and SD card line by line...the line to read selected by a variable.
The variable will be at the start of each line in the recorded data ie line 1. 2. 3. 4. etc if this is any help.

Is the output of inf for a division because the data is too small to display or out of the range of my doubles?

Inf means infinity, not too small.Inf is generally the result of doing something dumb, like dividing by 0.

And how can I read a file from and SD card line by line...the line to read selected by a variable.

You can't. There is nothing that defines a "line". There are only characters/byte. By convention, some of those bytes do funny things to print heads and paper feed mechanisms and cursor positions.

You can read and store the data in an array until one of those funny bytes is found ('\n' or '\r'). You can count the number of times one of those funny characters has some along, to see if you have the right "line".

Now, if you have fixed length records, the story is a lot different. In that case, there is no reason to read the whole file, You can seek() to the start of the nth record.

In terms of the double type, the AVR GCC compiler treats double as float, which means you have much less precision and exponent range than you would on other systems. If your numbers are larger than approximately 1.0e+38, the floating point emulation routines will convert the result to Infinity.

Yeah each entry will be a fixed length
They say the recording number then a speed in this format:

  1. 10cm/s
  2. 40cm/s

and so on. How would I use the seek method for this? And how would this be affected after 10 or 100 or 1000? id imagine this can be got around using if statements for the reading numbers if this makes a difference to how its seeked.

Each entry to two decimal places.
Id mainly be looking to seek the "1. " or "2. " I'd imagine but I'm unfamiliar with this method

Can I do a similar thing with the position method?

They say the recording number then a speed in this format:
Each entry to two decimal places.

What happens after 99 recordings?

Since the recording number and the record number are the same number, the recording number is useless data. Get rid of it. The cm/s part is useless to. Get rid of it.

Id mainly be looking to seek the "1. " or "2. " I'd imagine but I'm unfamiliar with this method

You don't seek() for characters in the file. You seek() a position in the file. If your records are all 4 characters - tens digit, ones digit, carriage return, and line feed - then record 1 starts at 0, record 2 starts at 4, record 3 starts at 8, etc. In general, then, record n starts at 4 * (n - 1), and is 4 characters long, only two of which have any meaning.

How would that work with a data range from 0.00 to 200.00, for example, the number of characters will vary from 3 to 6?
I'm thinking i could use an if statement to keep reading from a position to count the number of characters to a break character i could add to the save? so if it reaches a -, for example, itd stop a loop then read that many characters?

How would that work with a data range from 0.00 to 200.00, for example, the number of characters will vary from 3 to 6?

If you don't have fixed length records, it won't work at all.

I'm thinking i could use an if statement to keep reading from a position to count the number of characters to a break character i could add to the save?

No, because you have no idea where the nth record starts, since it is a function of the length of the n-1 variable length records before it.