On Wed, 8 Jan 2014, Allin Cottrell wrote:
On Wed, 8 Jan 2014, Sven Schreiber wrote:
> Also, in principle the data are now changed with respect to the old
> format I guess; hopefully just within the precision error margin of
> doubles, but this should probably be tested -- or did you already?
I did. We need 17 signifcant digits if we're to reproduce exactly results
obtained using (e.g.) logs and random numbers (by reproduce I mean: run a
regression, save data, reopen data, run regression again.) But we still use
17 digits if that's required -- that is, if printing to 15 digits doesn't
leave trailing zeros. [Personally, I think logs and random numbers should be
generated by script not saved in a data file, but anyway.]
This may be a bit obscure. To get the point, try the following
little script:
<hansl>
matrix m1 = {1.261, 5.777, 8.981}'
matrix m2 = log(m1)
# print to 17 digits
printf "\n%.17g\n", m1
printf "\n%.17g\n", m2
# and to 15
printf "\n%.15g\n", m1
printf "\n%.15g\n", m2
</hansl>
Note how the trailing junk disappears when we print the directly
entered values to 15 rather than 17 digits. Actually the last digits
of the logs (as printed to 17) are junk too, but they are specific
junk and we need to save it if we're to reproduce results exactly
after round-tripping via data save and re-open.
Here are the three logs above, as calculated in multiple precision
and as printed to 17 digits after calculation in standard double
precision:
log(1.261)
MP 0.2319050569827825061
doubles 0.23190505698278244
log(5.777)
MP 1.753884516799128482
doubles 1.7538845167991286
log(8.981)
MP 2.195111234688812681
doubles 2.1951112346888126
(MP results courtesy of
http://apfloat.appspot.com/)
Allin