Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

ToExpresssion doesn't understand real numbers of the form "1.34e5". How do I convert the string "1.34e5" to a real number in Mathematica?

share|improve this question

marked as duplicate by RunnyKine, m_goldberg, Oleksandr R., Jens, Szabolcs Jun 6 '14 at 22:34

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.

I think this question is ill-posed. Mathematica does not normally produce numeric strings of the form in question. Therefore, it seems reasonable to presume the source of the string is external. Should that be the case, then the conversion would be best handled during import. However, becko gives us no information about the source, essentially prohibiting the use of Mathematica;s import mechanisms to solve the problem. –  m_goldberg Jun 6 '14 at 22:11
ImportString["1.34e5", "Table"][[1, 1]] –  rasher Jun 6 '14 at 22:21
ImportString["1.34e5", "JSON"] –  m_goldberg Jun 6 '14 at 22:25
@RunnyKine - maybe its a duplicate, but this question should remain opened for a while (there are many new users like myself). –  eldo Jun 6 '14 at 22:27
@m_goldberg The source is a file containing rows of numbers. All rows are not of the same size, so it is not a matrix (therefore Import with option "Table" doesn't work). If that's relevant I can add it to the question. –  becko Jun 6 '14 at 22:33

1 Answer 1

up vote 3 down vote accepted

Possibly the simplest solution is

ImportString["1.34e5", "JSON"]



share|improve this answer
It is short, yes, but I don't understand it. –  eldo Jun 6 '14 at 22:32
@eldo. Added references you might want to look at –  m_goldberg Jun 6 '14 at 23:12

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