%=

From WikiManual
Revision as of 21:45, 20 January 2007 by Sprotiel (talk | contribs) (rewrite and explanation on limit cases)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

%= and !%= are approximate equality operators.

When the two values placed on the stack are within 10% of the first one (chronologically), %= places a "true" on the conditions stack. !%= returns the opposite of %= and is equivalent to %= not.

Example
50 55 %= will place "true" on the conditions stack.

More details

In VisualBasic, the actual operation used to handle a b %= is (equivalent to) Abs(a - b) <= a/10, where all operations are performed on Single-precision integers. Therefore, 9 10 %= is false because 9/10 evaluates to 0, while 10 9 %= is true because 10/10 evaluates to 1.

Logical Comparison Operators:

> <
>= <=
= !=
%= !%=
~= !~=