Jump to content

Set of real numbers: Difference between revisions

m
→‎{{header|Phix}}: minor simplification (use %t)
(Remove "{{omit from|Delphi}}" tag and added Delphi example)
m (→‎{{header|Phix}}: minor simplification (use %t))
Line 2,175:
{"[0,2) n (1,2]", {0,0,0}, {Inter,{{ClOp,{0,2}},{OpCl,{1,2}}}}},
{"[0,3) - (0,1)", {1,1,1}, {Diffr,{{ClOp,{0,3}},{OpOp,{0,1}}}}},
{"[0,3) - [0,1]", {0,0,1}, {Diffr,{{ClOp,{0,3}},{ClCl,{0,1}}}}}},
tf = {"True","False"}
 
for i=1 to length(s) do
Line 2,183 ⟶ 2,182:
bool r = cf(method,x)
string error = iff(r!=expect[x+1]?"error":"")
printf(1,"%d in %s : %st %s\n", {x, desc, tf[2-r], error})
end for
printf(1,"\n")
Line 2,189 ⟶ 2,188:
{{out}}
<pre>
0 in (0,1] u [0,2) : Truetrue
1 in (0,1] u [0,2) : Truetrue
2 in (0,1] u [0,2) : Falsefalse
 
0 in [0,2) n (1,2] : Falsefalse
1 in [0,2) n (1,2] : Falsefalse
2 in [0,2) n (1,2] : Falsefalse
 
0 in [0,3) - (0,1) : Truetrue
1 in [0,3) - (0,1) : Truetrue
2 in [0,3) - (0,1) : Truetrue
 
0 in [0,3) - [0,1] : Falsefalse
1 in [0,3) - [0,1] : Falsefalse
2 in [0,3) - [0,1] : Truetrue
</pre>
Extra credit - also translated from Go, but with an extended loop and crude summation, inspired by Java/Kotlin.
7,820

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.