# How to read long numbers? [duplicate]

This question already has an answer here:

Now, I have a data file (abc.dat) and it includes many long-Fortran-like numerical numbers as follows,

 6.329743394299864138426200801048403E-0008
-2.549598515596261539775494416553164E-0005
-4.070996338361811028817170114484442E-0005


How to read these data in Mathematica? If we use ReadList["abc.dat",Real] and it is not available for these long numbers. If we use ReadList["abc.dat", Record], then we need to find a way to change the string to numbers. Is there some better way for dealing with this problem ?

## marked as duplicate by m_goldberg, bobthechemist, ciao, Sjoerd C. de Vries, Michael E2Apr 6 '14 at 17:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• Read as text, then use something like ToExpression[StringReplace[nums, "E" -> "*10^"]] on that list. However, ReadList[...,Number] should handle the Fortran style. – ciao Apr 5 '14 at 6:27
• – ciao Apr 5 '14 at 6:51
• In version 7 ReadList["abc.dat", Real] appears to work correctly, yielding: {6.32974339429986413842620080104840*10^-8, -0.0000254959851559626153977549441655316, -0.0000407099633836181102881717011448444}. What output do you get? – Mr.Wizard Apr 5 '14 at 6:53
• – Mr.Wizard Apr 5 '14 at 6:54
• @Mr.Wizard: Looks like a possible bug in V9... – ciao Apr 5 '14 at 7:13

## 1 Answer

I opened HxD and pasted your numbers and saved as abc.dat. Then this worked for (8.0.4.0):

Import["C:\\f1\\f2\\Desktop\\abc.dat"]
(*{{6.32974339429986413842620080104840\[CenterDot]10^-8},{-0.0000254959851559626153977549441655316},{-0.0000407099633836181102881717011448444}}*)

• Incidentally in version 7 Import does not work fully here: data is imported as machine reals, losing input precision. – Mr.Wizard Apr 5 '14 at 6:59