Is Put - Get cycle in Mathematica always deterministic?
- To: mathgroup at smc.vnet.net
- Subject: [mg119874] Is Put - Get cycle in Mathematica always deterministic?
- From: Alexey Popkov <lehin.p at gmail.com>
- Date: Mon, 27 Jun 2011 07:31:50 -0400 (EDT)
- Reply-to: comp.soft-sys.math.mathematica at googlegroups.com
In Mathematica as in other systems of computer math the numbers are internally stored in binary form. However when exporting them with such functions as Put and PutAppend they are converted into approximate decimals. When we import them back with such functions as Get they are restored backward from this approximate decimal representation to binary form. The question is: whether the recovered number is always identical to the original binary number and, if not always, in which cases it is not and how great can be the difference? I am particularly interested in the Put - Get cycle (on the same computer system).
I am aware of DumpSave which is guaranteed to restore original definitions exactly but I am interested in exporting expressions in human-readable format. I am quite satisfied with the default ASCII-based representation created by Put and PutAppend.
The following two simple experiments show that probably the Put - Get cycle in Mathematica always restores original numbers exactly both for machine precision and for arbitrary precision numbers. I rely in these experiments on the Order function for expression comparison instead of SameQ because the latter "still considers Real numbers equal if they differ in their last binary digit" while the former returns 0 only if the expressions are exactly the same.
It seems the the Put - Get cycle always restores the original numbers exactly. But may be I am missing something?
Prev by Date:
Next by Date:
Re: Assigning part of indexed object
Previous by thread:
Next by thread:
C code generation