Politically incorrect response to Re: a bug in RealDigits? Mathematica 5.0
- To: mathgroup at smc.vnet.net
- Subject: [mg45259] Politically incorrect response to Re: a bug in RealDigits? Mathematica 5.0
- From: ancow65 at yahoo.com (AC)
- Date: Wed, 24 Dec 2003 04:35:59 -0500 (EST)
- References: <bs1btt$9pt$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
nma124 at hotmail.com (steve_H) wrote in message news:<bs1btt$9pt$1 at smc.vnet.net>...
> hello;
>
> Mathematica 5.0, student version, on XP home edition:
>
> t1 = 39383738378094852309445543850343.49494
>
> {c, d} = RealDigits[t1];
>
> now c is
>
> {3, 9, 3, 8, 3, 7, 3, 8, 3, 7, 8, 0, 9, 4, 8, 5, 2, 3, 0, 9,
> 4, 4, 5, 5, 4, 3, 8, 5, 0, 3, 4, 3, 4, 9, 4, 9}
>
> notice that I typed in the last digits of t1 as '.49494', i.e the
> number to the right of the decimal point.
>
> But 'c' above is missing the last digit, it only reports '4,9,4,9'
> instead of '4,9,4,9,4'
>
> What happened to the last digit '4' ?
Got lost in bad software engineering.
The manual says
"RealDigits[x] normally returns a list of digits whose length is equal
to Precision[x]."
Unfortunately, the precise meaning of "normally" is yet to be known.
If you take t1=45543850343.49494; RealDigits[t1] returns all digits
because Precision[t1] is now MachinePrecision.
Because MachinePrecision depends on the underlying hardware
architecture, Mathematica programs are hardware dependent! It is
already custom that Mathematica programs change behavior when a new
version is released. Additionally that can happen when changing
hardware. That is horrible.
The vagueness of Mathematica's manual is just a cover-up for a serious
design flaw.
AC