Skip to content

truncate fails at compile-time for 32-bits #144

@arnetheduck

Description

@arnetheduck
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions