Message Boards Message Boards

GROUPS:

Import numerical data without truncation

Posted 2 months ago
558 Views
|
4 Replies
|
1 Total Likes
|

Hi, I have a data file consisting of 4 columns with floating numbers generated by a C program, with each number given to 16 significant digits. I've used the Import command and also ReadList to import this data to a Mathematica notebook: data=Import["file.dat"] or ReadList["file.dat",{Number,Number,Number,Number}]. Either way, Mathematica is only importing the first 6 significant digits of each number. Is there a way around this so that all the significant digits are read? Thanks.

David Halpern

4 Replies

From what I read I think you are actually do import all significant bits, but Mathematica only shows the first 6 by default. You can check by:

Pi // N
FullForm[%]
Posted 2 months ago

Thanks for the response but I still don't quite understand what is happening.

Here is what I do. (1) I import a matrix A using A=Import"data.dat" If I type A[[1,2]] I get 0.992745. (3) If Itype N[A[[1,2]],16]] I get exactly the same answer as in (2), which in my opinion is strange since the result should be given to 16 digit precision. However, if I use the FullForm command, I get all the digits 0.99274468827 that were stored in the file data.dat.

Posted 2 months ago

Hi David,

Take a look at this post on MSE for an explanation.

Again, it is just SHOWING 6 digits for a machine number. Under the Preferences => Appearance => Formatting => Numbers you can set the number of digits, displayed by default.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract