Closed
Description
This isn't a fatal issue in practice, but I ran into it in testing multiplication code.
julia> BigFloat(0x0_01234567_89abcdef) % N63f1 |> reinterpret
0x0123456789abcdef
julia> BigFloat(0x1_01234567_89abcdef) % N63f1 |> reinterpret
0xffffffffffffffff
The cause is the unsafe_trunc
.
julia> r = 0x1_01234567_89abcdef;
julia> bf = BigFloat(r)
1.8528729602926038511e+19
julia> bi = BigInt(bf)
18528729602926038511
julia> unsafe_trunc(UInt64, bf)
0xffffffffffffffff
julia> unsafe_trunc(UInt64, bi)
0x0123456789abcdef
Perhaps it would be better to convert via BigInt
.
Metadata
Metadata
Assignees
Labels
No labels