Assume that the output of my calculation is a and is a number such as:
a = 100.1252135246354847;
N[a] gives me 100.125
However, when I try to save my data, a via export such as :
Export["/path/to/file/with/extension/dat", N[a]]
My eventual filename.dat has 100.12521352463548 and not 100.125.
So is the precision of digits/most significant digits for display only?
I also tried NumberForm[a,6] and I get NumberForm[100.1252135246354847`18.000543455259304, 6] in my data file!
What am I doing wrong?
Edit (possible solution):
Replacing N[a] with SetPrecision[a,5] helped.
I wasn't sure if I should have this in the ANSWER section because the solution may be quite trivial and may not warrant being in the answer section.
Any thoughts on that (whether or not I should answer this question or let the solution remain as an appended "edit")
PrintPrecisionis the reason. See this topic for same exact issue stackoverflow.com/questions/8958531/… – Nasser Aug 28 '12 at 1:45