# Exporting data to txt file

I am doing a calculation that I have set the precision to 20 i.e. N[expression,20] and the output on Mma is indeed 20 significant digits, but when I export this number to a txt file, I get more than that. Any idea how to remedy that, and my txt file to contain the same 20 digits that they are output to Mma?

You could try blocking $NumberMarks: Block[{$NumberMarks=False},

"3.14159265358979323846

Block[{$NumberMarks = False}, Export["file.txt", N[{Pi, E, Pi^E}, 20], "Text"] ]; Import["file.txt", "String"]  "3.14159265358979323846 2.71828182845904523536 22.4591577183610454734"  • Thank you. But would you have an explanation on why this happens? – hal May 13 at 18:11 • Hi again. I tried what you proposed but it still doesn't work. The Mma GUI gives 20 digits significant precision, i.e. -6548.825915592645347 but the exported txt file gives -6548.8259155926453472245505608027729842179919.81219934315515. – hal May 14 at 8:27 • @hal What export format did you use, what was the exact Export call you used? And, what was the Mathematica version and OS? – Carl Woll May 14 at 13:41 • Hi again, ok it worked. I didn't include the "Text" piece in the export. But any idea why without it, it fails to impose the $NumberMarks = False`? – hal May 20 at 13:59