also looking at this
fix(interpreter): keep 2^63 as a float in floor, ceil and round
#932
2 files
+22
-3
| @@ -46,6 +46,23 @@ test "eval: print a string literal (hello world)" { | ||
| 46 | 46 | ); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | test "eval: floor, ceil and round keep 2^63 as a float" { | |
| 50 | try runProgram( | |
| 51 | \\fn main() { | |
| 52 | \\ let max = 9223372036854775807.0 | |
| 53 | \\ assert(is_float(floor(max))) | |
| 54 | \\ assert(is_float(ceil(max))) | |
| 55 | \\ assert(is_float(round(max))) | |
| 56 | \\ assert(is_int(floor(9223372036854774784.0))) | |
| 57 | \\ assert(floor(9223372036854774784.0) == 9223372036854774784) | |
| 58 | \\ assert(is_int(ceil(-9223372036854775808.0))) | |
| 59 | \\ assert(ceil(-9223372036854775808.0) == -9223372036854775807 - 1) | |
| 60 | \\ assert(is_int(round(2.5))) | |
| 61 | \\ assert(round(2.5) == 3) | |
| 62 | \\} | |
| 63 | ); | |
| 64 | } | |
| 65 | ||
| 49 | 66 | test "eval: let-binding then use" { |
| 50 | 67 | try runProgram( |
| 51 | 68 | \\fn main() { |