Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: SetPrecision - What does in find?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48605] Re: SetPrecision - What does in find?
  • From: ab_def at prontomail.com (Maxim)
  • Date: Mon, 7 Jun 2004 05:33:38 -0400 (EDT)
  • References: <c8kcs0$mpv$1@smc.vnet.net> <c8mumk$a4t$1@smc.vnet.net> <c944pq$r43$1@smc.vnet.net> <c96i11$ijt$1@smc.vnet.net> <c9ec18$g88$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

There's a glitch in SetPrecision[n,Infinity] though: it doesn't
preserve the hidden digits of n. Suppose we have n=1`20/3; Mathematica
will generate a number with 40 threes, 20 of which will be
significant. Now if we do SetPrecision[n,50], then Mathematica firstly
will use the hidden digits and only after that the number will be
padded with zeros. This means that SetPrecision[n,50]-1/3 is
approximately 10^-40:

In[1]:=
SetPrecision[1`20/3, 50] - 1/3 // N

Out[1]=
-9.795786256852395*^-40

This works just as described in the documentation; but if we do
SetPrecision[n,Infinity], then only the 20 significant digits are
used:

In[2]:=
SetPrecision[1`20/3, Infinity] - 1/3 // N

Out[2]=
5.646886315028669*^-22

Maxim Rytin
m.r at inbox.ru


  • Prev by Date: Max [a,-inf]
  • Next by Date: Where does Return return to?
  • Previous by thread: Max [a,-inf]
  • Next by thread: Where does Return return to?