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
julia>2*0.5Q1f14
ERROR:InexactError()
Stacktrace:
[1] convert at /home/fengyang/.julia/v0.6/FixedPointNumbers/src/fixed.jl:42 [inlined]
[2] promote at ./promotion.jl:174 [inlined]
[3] *(::Int64, ::FixedPointNumbers.Fixed{Int16,14}) at ./promotion.jl:247
This is happening because 2 is not representable in Q1f14, even though the result 1 would be. I think it is avoidable by specializing ::Integer * ::FixedPoint (and ::FixedPoint * ::Integer?) directly, but I don't have much experience with this. If this is the right thing to do, I'll make a PR.
The text was updated successfully, but these errors were encountered:
Yes this is due to our promote rules... I think implementing ::Integer * ::FixedPoint is fine, but we need to think about whether we want to check for overflow.
I misunderstood this issue. This is a problem with promotion rules only for Fixed, not for Normed. Since the birth of Normed (formerly UFixed), i.e. PR #2, it has been promoted to Float32/Float64.
I thought the checked_mul could avoid unnecessary errors, but that would lead to further inconsistencies. 😕
This is happening because
2
is not representable in Q1f14, even though the result1
would be. I think it is avoidable by specializing::Integer * ::FixedPoint
(and::FixedPoint * ::Integer
?) directly, but I don't have much experience with this. If this is the right thing to do, I'll make a PR.The text was updated successfully, but these errors were encountered: