Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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,


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 ?

share|improve this question

marked as duplicate by m_goldberg, bobthechemist, ciao, Sjoerd C. de Vries, Michael E2 Apr 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
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: Looks like a possible bug in V9... – ciao Apr 5 '14 at 7:13

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

share|improve this answer
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

Not the answer you're looking for? Browse other questions tagged or ask your own question.