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:
+1
-1
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user