Message Boards Message Boards

Result of Equal with multiple arguments

Posted 5 years ago
POSTED BY: Martin Guttmann
9 Replies

I don't know the exact meaning of $EqualTolerance, but its value is 7 bits.

In[108]:= Internal`$EqualTolerance/Log10[2]
Out[108]= 7.

What does that mean? It is not sufficient to compare the last 7 (binary) digits. Using a decimal example, the last 1 digit of 999 and 1000 are not the same even though their difference is only 1. Similarly, a<1 but c>b>1.

If we offset them, we get rid of this problem.

What is the difference between ({a, b, c} + 0.00000005551145) and ({a, b, c} + 0.00000005551146) (see my last post)?

Let's see their binary digits:

enter image description here

Notice that the one that returns False has 7 digits of difference, the other only 6. 7 is exactly the threshold. The behaviour must have something to do with this.

But I still do not understand it.

POSTED BY: Szabolcs Horvát

It's weird that it does this:

In[91]:= Equal @@ ({a, b, c} - 0.1)
Out[91]= False

In[92]:= Equal @@ ({a, b, c} - 0.2)
Out[92]= True

In[93]:= Equal @@ ({a, b, c} - 0.3)
Out[93]= False

In[94]:= Equal @@ ({a, b, c} + 0.00000005551146)
Out[94]= True

In[95]:= Equal @@ ({a, b, c} + 0.00000005551145)
Out[95]= False
POSTED BY: Szabolcs Horvát

[removed, because I read the question wrong]

POSTED BY: Arnoud Buzing

In my System (Mma 7.0) a == b == c gives True.

POSTED BY: Hans Dolhaine

In my System (Mma 7.0) a == b == c gives True.

I checked several versions. v10.0 and later give False. v7, v8 and v9 give True. Our institutional cluster even has v6 installed, but it no longer starts up on modern Linux.

POSTED BY: Szabolcs Horvát

No more comments? Where can I post a bug report?

POSTED BY: Martin Guttmann
POSTED BY: Szabolcs Horvát

The order still doesn't matter fortunately:

a == b == c
a == c == b
b == c == a
b == a == c
c == a == b
c == b == a

all give the same…

Maybe the one-bit-off doesn't work anymore for the general vararg?

POSTED BY: Sander Huisman

Interesting question! I'm not sure how it works for varargs… very strange it works like this, smells like a bug?!

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract