Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'Another accuracy/precision related question' topicStudent Support Forum > General > "Another accuracy/precision related question"

Help | Reply To Topic
Author Comment/Response
david silverman
11/21/00 08:51am

This problem came up a while ago, and I decided not to use Mathematica in this
instance, so the problem went away, but I am curious about how to solve it.

I don't have the code that didn't work anymore, but here is the situation. I have
a text data file of numbers. I read the numbers in and assign them to variables. I
write the numbers out to a new file. If I check the variable values in Mathematica
by typing in the variable name and evaluating, the values are exactly correct. If
I look at the output file I created, a large number of the numbers have
...9999..... at the end.

I guess you can say that to the precision of the machine they are exactly the
same, but all I did was read in a number like 2.7 and immediately write it out,
and I get 2.6999...... Unfortunately (for me), sometimes these numbers are, um,
numbers, but sometimes they are codes or indices where the number of decimal
places or whether it is an integer or not is important.

So, is there a way, without reading each numeral in as text, to read a number in
and write it out so it is exactly the same as the original?



URL: ,
Help | Reply To Topic