       Re: Bug 1+4/10

• To: mathgroup at smc.vnet.net
• Subject: [mg120036] Re: Bug 1+4/10
• From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
• Date: Thu, 7 Jul 2011 07:27:09 -0400 (EDT)
• References: <iv1acv\$sk7\$1@smc.vnet.net>

```On Wed, 06 Jul 2011 10:37:35 +0100, slawek <slawek at host.pl> wrote:

> Let check
>
> In:= 1.4 == 1 + 4/10
> Out= True
>
> In:= a = SetPrecision[1.4, 30]
> Out= 1.39999999999999991118215802999
>
> In:= b = SetPrecision[1 + 4/10, 30]
> Out= 1.40000000000000000000000000000
>
> No comment is needed.
>
> slawek

Yet:

In :=
a == b

Out =
False

So here we have shown that a number padded with binary zeros is generally
not equal to the same number padded with decimal zeros. I doubt anyone can
be surprised by this. However, they are still comparable in a sense:

In :=
a = SetPrecision[Interval[1.4], 30]

Out =
Interval[{1.39999999999999968913755310495,
1.40000000000000013322676295502}]

In :=
b = SetPrecision[Interval[1 + 4/10], 30]

Out=
Interval[{1.40000000000000000000000000000,
1.40000000000000000000000000000}]

In :=
IntervalMemberQ[a, b]

Out =
True

Proper treatment of inexact numbers requires at least some care and
attention. It is important to remember that one is operating on
distributions rather than points, so simplistic notions of arithmetic
equality are not meaningful.

```

• Prev by Date: Re: How to write a "proper" math document
• Next by Date: Re: How can I get better solution for this...?
• Previous by thread: Re: Bug 1+4/10
• Next by thread: Re: Bug 1+4/10