Approximate equality: Difference between revisions

Line 1,364:
Stdout printCR: e'{val1} =~= {val2} -> {val1 isAlmostEqualTo:val2 nEpsilon:2}'
]</lang>
In CUIS, this method is called <tt>isWithin:nULPS floatsFrom:</tt>.
{{out}}
<pre>100.01 =~= 100.011 -> false
Line 1,373:
-2.0 =~= -2.0 -> true
3.14159265358979 =~= 3.14159265358979 -> true</pre>
Notice, byBy default, double precision IEEE floats are used.
 
=={{header|Swift}}==
Anonymous user