You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
can not convert float to the same or more number of bit fixed point #102
Maybe it's worth checking if the x argument is one?
FYI, since the length of the mantissa part of Float32 is 23 (+1) bits, this is not a problem just when x argument is one.
julia>for f=1:32; Float32(exp2(32-f)) |> Normed{UInt32,f};end
ERROR: ArgumentError: Normed{UInt32,25} is a 32-bit type representing 4294967296 values from 0.0 to 128.0; cannot represent 128.0
Similarly, the length of the mantissa part of Float64 is 52 (+1) bits.
julia>for f=1:64; Float64(exp2(64-f)) |> Normed{UInt64,f};end
ERROR: ArgumentError: Normed{UInt64,54} is a 64-bit type representing 0 values from 0.0 to 1024.0; cannot represent 1024.0
Fixing this problem may be useful for the round trip testing to check the conversions.
Activity
giordano commentedon Mar 15, 2018
I just run into the same error. The problem is in
_convert(::Type{U}, ::Type{T}, x) where {U <: Normed,T}function:FixedPointNumbers.jl/src/normed.jl
Lines 52 to 55 in cf9ebc4
E.g., in
the
yvariable is equal towhich is larger than the maximum number that can be represented with
UInt64:Maybe it's worth checking if the
xargument is one?kimikage commentedon Oct 26, 2019
FYI, since the length of the mantissa part of
Float32is23 (+1)bits, this is not a problem just whenxargument is one.Similarly, the length of the mantissa part of
Float64is52 (+1)bits.Fixing this problem may be useful for the round trip testing to check the conversions.
kimikage commentedon Nov 2, 2019
PR #131 does not change the
rem.Originally posted by @kimikage in #131 (comment)
When you are faced by a problem with
rem, please report it as a new issue.Merge pull request JuliaMath#131 from kimikage/issue102