I have a file with lines of numbers that look like this:
1.000000-5 2.436700+0 2.530000-2 2.436700+0 5.000000-2 2.436700+0
1.000000+1 2.436700+0 1.000000+2 2.433800+0 1.000000+3 2.433800+0
I need to read this with C++ to get numbers
1.0E-5 2.4367E0 2.53E-2 2.4367E0 5.0E-2 2.4367E0
1.0E1 2.4367E0 1.0E2 2.4338E0 1.0E3 2.4338E0
The challenge is that there is no E
in the numbers of the file; the E
indicates the exponential notation.
How can I read something like this into a float? It needs to be very efficient because I have to read such a number hundreds of thousands or millions of times for each file.
Any suggestions on how to make this happen?