|
[Date Index]
[Thread Index]
[Author Index]
SetPrecision[]
- To: mathgroup at yoda.ncsa.uiuc.edu
- Subject: SetPrecision[]
- From: uunet!yoda.ncsa.uiuc.edu!keiper%wri (Jerry Keiper)
- Date: Mon, 2 Apr 90 17:24:41 CDT
Jeffrey P. Golden <uiucuxc!ALLEGHENY.SCRC.Symbolics.COM!jpg> writes:
>If the user types SetPrecision[1.2,30], I think it is pretty clear
>that most users mean the same number that SetPrecision[12/10,30]
>would mean, i.e. fill in with decimal 0's, which is not what
>Mathematica does.
Since that sort of functionality is in general impossible, I presume that
the suggestion is only intended to make it more convenient to enter
numbers precisely. But the 1.2 will have been converted to 1.001100110011...
long before SetPrecision[] ever even gets to look at it. If the above
functionality is desired one can do something like
HighPrecision[x_, n_] := SetPrecision[Rationalize[x], n]
then
In[9]:= HighPrecision[1.2,40]
Out[9]= 1.2
In[10]:= SetPrecision[%, 60]
Out[10]= 1.19999999999999999999999999999999999999999999999917892668106
But this will only work for numbers that are essentially rational numbers
with relatively small denominators with a small rounding error thrown in
to allow it to be represented in binary.
I do not think that overloading SetPrecision[] to have this functionality
is appropriate.
Jerry Keiper
keiper at wri.com
Wolfram Research Inc.
Next by Date:
precision and accuracy
Next by thread:
Re: SetPrecision[]
|