nim-stint icon indicating copy to clipboard operation
nim-stint copied to clipboard

`truncate` fails at compile-time for 32-bits

Open arnetheduck opened this issue 2 years ago • 0 comments

    let a = -1_000_000.stint(64)
    let b = 1_000_000.stint(64)

    check:
      when sizeof(int) == 8:
        truncate(a*b, int64) == -1_000_000_000_000'i64 # need 40 bits
        truncate(b*a, int64) == -1_000_000_000_000'i64
nim c --cpu:wasm32
test_int_muldiv.nim(151, 27): Check failed: truncate(a * b, int64) == -1000000000000'i64
truncate(a * b, int64) was -3567587328

arnetheduck avatar Sep 27 '23 08:09 arnetheduck