Approximate equality: Difference between revisions
m
→{{header|Wren}}: Changed to Wren S/H
Paulstgeorge (talk | contribs) |
m (→{{header|Wren}}: Changed to Wren S/H) |
||
(9 intermediate revisions by one other user not shown) | |||
Line 1,226:
True 3.14 ≅ 3.14</pre>
Traditionally I have always just used sprintf() to compare floating point atoms in phix.<br>
This task (imo) is trying to make a general-purpose routine out of code which is best tailored for each and every specific task.<br>
Line 1,301:
3.1415926535897931 are approximately equal
</pre>
=={{header|Processing}}==
<syntaxhighlight lang="
void setup() {
Line 1,331 ⟶ 1,330:
println("False. ", num1, "is not close to", num2);
}
}</syntaxhighlight>
{{Output}}
<pre>
True. 1.0000000000000002E14 is close to 1.0000000000000002E14
False. 100.01 is not close to 100.011
Line 2,107 ⟶ 2,104:
=={{header|Wren}}==
<syntaxhighlight lang="
var pairs = [
[100000000000000.01, 100000000000000.011],
|