| 1 | import math |
| 2 | |
| 3 | fn test_f64_to_u64_boundary_values() { |
| 4 | max_u64 := u64(-1) |
| 5 | pow_63 := math.pow(2, 63) |
| 6 | pow_64 := math.pow(2, 64) |
| 7 | high_step := pow_63 + 2048.0 |
| 8 | |
| 9 | assert u64(-1.0) == 0 |
| 10 | assert u64(pow_63) == u64(1) << 63 |
| 11 | assert u64(high_step) == (u64(1) << 63) + u64(2048) |
| 12 | assert u64(pow_64) == max_u64 |
| 13 | assert u64(f64(max_u64)) == max_u64 |
| 14 | } |
| 15 |