Peter,

Mathematica requires an unfortunate degree of relearning each time you use it for something non-standard, unless you use it constantly enough to keep its quirks at the top of your brain. In this instance, precision, as used in Mathematica, refers to the relative error, measured in terms of (approximately) the number of significant decimal places of accuracy, so that if a number x is known to within a possible absolute error dx, the precision is -Log[10,dx/x]. When using machine precision (IEE 64 bit representation on current Mac and PC), there are 53 bits available to represent the mantissa (exceptional cases aside, effectively a number between 1/2 and 1) and so the precision of an approximate real number x between 1/2 and 1 so represented is -Log[10,2^(-54)/x] which is at least -Log[10,2^(-53)] =53 Log[10,2], which is just under 16. The precision of an approximate real number x does not depend on its (base 2) exponent--- only its mantissa. By contrast, Mathematica uses the term accuracy for absolute error rather than relative error.

The value returned by RealDigits[x,2,100] is (a) the sequence of the first 100 binary digits in the mantissa, which always starts with the digit 1; (b) the base 2 exponent of x. If x is an approximate real number with machine precision, only the first 53 entries will be meaningful in (a). If you increase the precision to 31 (corresponds to at least 100 binary digits), by entering x as an expression like . 036`31 or N[36/1000,31], then all entries in (a) will be meaningful. As I mentioned above, the exponent is not relevant to the precision, though it would be to the accuracy, which has to do with absolute error.

Michael

On Aug 3, 2006, at 8:23 AM, Peter K. Stys wrote:


"confusing" is Mathematica's middle name IMHO.  I believe the -4 means
that the result begins 4 places to the right of the binary "decimal"
point.

P.

On 8/2/06, Bob Delaney <[EMAIL PROTECTED]> wrote:
Peter,

I agree, the precision is 100 places.

Looking at Mathematica's result again, it appears to be formally
incorrect. There is no binary point in front of the binary bits!
Shouldn't the "-4" be "-104"?

Or does "RealDigits[0.036`100, 2, 100]" imply that one first
multiplies .036 by 2^100. Then the answer is formally correct. That
would really be confusing!

Bob


Yes, i understand, but the PRECISION (if I use the term correctly) is
100 places.

Cheers,
P.


On 8/2/06, Bob Delaney <[EMAIL PROTECTED]> wrote:
Peter,

Because the "-4" means times 2^(-4), your result represents .036
accurate to 104 places following the binary point.

Bob




I've often wondered about trying Maple (any good?).

Anyway, here is a reply from Wolfram tech support, turns out I wasn't using Mathematica correctly (a common occurrence with me, not a simple
app to use).  Os other were correct, 0.036 is not base-2
representable, and this explains the integer round-down "error" first
reported in this thread.

======
I believe Mathematica is working correctly.

As specified in help of RealDigits, RealDigits[x]normally returns a list of
digits whose length is equal to Precision[x].

Please use the correct precision.

RealDigits[0.036`100, 2, 100]

returns:

{{1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0,
0,
1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1,
1,
1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0,
1,
1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1,
1,
     0, 0, 1}, -4}

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to