aboutsummaryrefslogtreecommitdiff
path: root/tests/conformance/3-expressions/ternary_int_float_variables.zc
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 17:09:14 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 17:09:14 +0330
commitf1eba8ef04e8902d7b797d9421d3e0c6f0045ae0 (patch)
tree159dd6fc86dbb3dfc0381f109681751085011c77 /tests/conformance/3-expressions/ternary_int_float_variables.zc
parentmerge work/xref: zc0 u*d redo and follow-ups (diff)
parentMerge branch 'main' into work/spec (diff)
merge work/spec: appendix b round, zc0umd rewrite
Diffstat (limited to 'tests/conformance/3-expressions/ternary_int_float_variables.zc')
-rw-r--r--tests/conformance/3-expressions/ternary_int_float_variables.zc8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/conformance/3-expressions/ternary_int_float_variables.zc b/tests/conformance/3-expressions/ternary_int_float_variables.zc
new file mode 100644
index 0000000..4bd2d57
--- /dev/null
+++ b/tests/conformance/3-expressions/ternary_int_float_variables.zc
@@ -0,0 +1,8 @@
+// expect: 3.000000/0.500000/3.000000/0.500000/
+// spec 3.5 and appendix b.2.5: ?: with an int side and a float side gives a float on both paths, also in o3
+include rt;
+fn pf(float f) { asm { f @ #1220 } rt.put_c(10); return 0; }
+float pick(int k, int i, float f) { return k ? i : f; }
+o3 float pick3(int k, int i, float f) { return k ? i : f; }
+fn main() { pf(pick(1, 3, 0.5)); pf(pick(0, 3, 0.5)); pf(pick3(1, 3, 0.5)); pf(pick3(0, 3, 0.5)); return 0; }
+// zc0: skip