-
Notifications
You must be signed in to change notification settings - Fork 33
[RFC] Changing the promotion type of Integer
and Fixed
to a float type.
#192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The rules for FixedPointNumbers.jl/src/fixed.jl Line 197 in 7c90fb6
FixedPointNumbers.jl/src/normed.jl Line 310 in 7c90fb6
|
If we decide to commonize the promotion rules, i.e. both |
Yes, we should go with the one used for Normed. julia> x = rand(N0f32)
0.3137734384N0f32
julia> promote(x, Float16(1.0))
(0.3137734384075211, 1.0)
julia> x = rand(Q1f30)
-1.7184696067Q1f30
julia> promote(x, Float16(1.0))
(Float16(-1.719), Float16(1.0)) |
I also want to commonize the following rules with #192 (comment). FixedPointNumbers.jl/src/fixed.jl Lines 200 to 213 in 0446a89
Also, I'm thinking of removing the Please note that this is a "general purpose" promotion rule and we can design the promotion rules for the arithmetic operations separately. |
Yes, in general my view is that From this standpoint, even julia> promote_type(N0f8, N1f7) === N8f8
true
julia> x = rand(N0f8)
0.651N0f8
julia> float(x) == float(convert(N8f8, x))
true
julia> x = rand(N1f7)
1.661N1f7
julia> float(x) == float(convert(N8f8, x))
false However, different |
Even in
I prefer to apply the same promotion policy for the |
WIP: master...kimikage:promotion_rule |
I was considering introducing
checked_mul
for Issue #78. However, I noticed that there are differences in promotion rules betweenFixed
andNormed
.Perhaps this is due to the current (historical) implementation where
Fixed
is signed andNormed
is unsigned, but IMO, it seems practical to promote them to float types, and not to add::Integer * ::FixedPoint
.The text was updated successfully, but these errors were encountered: