Add float division and integer/float coercion

This commit introduces support for floating-point division, including
cases where an integer is divided by a float or vice versa. This allows
for more flexible arithmetic operations within the DSL.

Additionally, the `Value::Float` display implementation is adjusted to
show `.0` for whole numbers, improving readability and consistency in
output.
This commit is contained in:
2026-03-31 23:09:02 +02:00
parent ed1b5bae7a
commit 9b38907cd5
3 changed files with 40 additions and 2 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ fn test_rtl_operators() {
assert_eq!(format!("{}", env.run_script("(+ 10 20)").unwrap()), "30");
assert_eq!(format!("{}", env.run_script("(- 20 10)").unwrap()), "10");
assert_eq!(format!("{}", env.run_script("(* 10 20)").unwrap()), "200");
assert_eq!(format!("{}", env.run_script("(/ 20 10)").unwrap()), "2");
assert_eq!(format!("{}", env.run_script("(/ 20 10)").unwrap()), "2.0");
assert_eq!(format!("{}", env.run_script("(// 20 3)").unwrap()), "6");
assert_eq!(format!("{}", env.run_script("(% 20 3)").unwrap()), "2");