Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #3519
| From | "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Bug 1+4/10 |
| Date | 2011-07-07 11:27 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <iv456e$eop$1@smc.vnet.net> (permalink) |
| References | <iv1acv$sk7$1@smc.vnet.net> |
On Wed, 06 Jul 2011 10:37:35 +0100, slawek <slawek@host.pl> wrote:
> Let check
>
> In[1]:= 1.4 == 1 + 4/10
> Out[1]= True
>
> In[2]:= a = SetPrecision[1.4, 30]
> Out[2]= 1.39999999999999991118215802999
>
> In[3]:= b = SetPrecision[1 + 4/10, 30]
> Out[3]= 1.40000000000000000000000000000
>
> No comment is needed.
>
> slawek
Yet:
In[4] :=
a == b
Out[4] =
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[5] :=
a = SetPrecision[Interval[1.4], 30]
Out[5] =
Interval[{1.39999999999999968913755310495,
1.40000000000000013322676295502}]
In[6] :=
b = SetPrecision[Interval[1 + 4/10], 30]
Out[6]=
Interval[{1.40000000000000000000000000000,
1.40000000000000000000000000000}]
In[7] :=
IntervalMemberQ[a, b]
Out[7] =
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.
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Bug 1+4/10 "slawek" <slawek@host.pl> - 2011-07-06 09:37 +0000
Re: Bug 1+4/10 Peter Breitfeld <phbrf@t-online.de> - 2011-07-06 11:06 +0000
Re: Bug 1+4/10 "slawek" <slawek@host.pl> - 2011-07-07 11:41 +0000
Re: Bug 1+4/10 "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-07-07 11:27 +0000
Re: Bug 1+4/10 "slawek" <human@site.pl> - 2011-07-08 08:52 +0000
Re: Bug 1+4/10 "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-07-09 11:41 +0000
Re: Bug 1+4/10 Daniel Lichtblau <danl@wolfram.com> - 2011-07-07 11:35 +0000
csiph-web