Re: a bug in RealDigits? Mathematica 5.0
- To: mathgroup at smc.vnet.net
- Subject: [mg45219] Re: [mg45211] a bug in RealDigits? Mathematica 5.0
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Sun, 21 Dec 2003 03:42:13 -0500 (EST)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200312201056.FAA09603@smc.vnet.net>
- Reply-to: murray at math.umass.edu
- Sender: owner-wri-mathgroup at wolfram.com
It looks like a simple matter of loss of precision:
t1 = 39383738378094852309445543850343.49494;
Precision[t1]
36.5953
You need to specify you want greater precision, presumably the full 37
digits:
t2 = 39383738378094852309445543850343.49494`37
Precision[t2]
37.
First @ RealDigits[t2]
{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, 4}
You may accomplish the same thing with:
t2 = SetPrecision[39383738378094852309445543850343.49494, 37]
steve_H wrote:
> 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' ?
>
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
- References:
- a bug in RealDigits? Mathematica 5.0
- From: nma124@hotmail.com (steve_H)
- a bug in RealDigits? Mathematica 5.0