Re: 34.123*89 = 3036.95 (3036.947)

• To: mathgroup at smc.vnet.net
• Subject: [mg47916] Re: 34.123*89 = 3036.95 (3036.947)
• From: "Christopher J. Henrich" <chenrich at monmouth.com>
• Date: Fri, 30 Apr 2004 19:26:54 -0400 (EDT)
• References: <c6s538\$pkf\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```In article <c6s538\$pkf\$1 at smc.vnet.net>, Thomas Schulz
<thomas-k-schulz at t-online.de> wrote:

> I am a NewBe - and i dont understand the Result.
> Mathematica says that 34.123*89 = 3036.94699999997 but its 3036.947...
> How can i change this?
>
> i use a IBook (G4) with Mac OS X.
> THX
> Thomas
>
Mathematica interprets decimal numbers like "34.123" in floating point.
A floating-point number is, mathematically, an integer times a power of
two.  For different precisions, one has different restrictions on the
integer and the exponent.

We are accustomed to think of "34.123" as an integer times a power of
10, specifically, 34123 * 10^-3.  Mathematica found the nearest
floating point number,and apparently it happened to be slightly less
that 34123/1000.

If you had asked for (34123/1000)*89 you would have ot an exact result.
Indeed, if you give Mathematica exact input and do not request a
numerical approximation of the result, it will do its best to compute
an exact answer even if this involves ridiculously big numerators and
denominators.  Try (34123/1000)^89.

--
Chris Henrich
Yes, one can rant about the program designs, but generally things keep getting
more and more confused as time goes on. --Sea Wasp

```

• Prev by Date: Re: bug in IntegerPart ?
• Next by Date: RE : 34.123*89 = 3036.95 (3036.947)
• Previous by thread: Re: 34.123*89 = 3036.95 (3036.947)
• Next by thread: Re: 34.123*89 = 3036.95 (3036.947)