Skip to content
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

promotion #18

Closed
bjarthur opened this issue Feb 3, 2023 · 4 comments · Fixed by #19
Closed

promotion #18

bjarthur opened this issue Feb 3, 2023 · 4 comments · Fixed by #19

Comments

@bjarthur
Copy link

bjarthur commented Feb 3, 2023

would be nice if this worked:

julia> Float8(1.0) * Float32(1.0)
ERROR: promotion of types Float8 and Float32 failed to change any arguments

very useful package btw!

@milankl
Copy link
Member

milankl commented Feb 6, 2023

Just define promotion

Base.promote_rule(::Type{Float8},::Type{Float16}) = Float16
Base.promote_rule(::Type{Float8},::Type{Float32}) = Float32
Base.promote_rule(::Type{Float8},::Type{Float64}) = Float64
Base.promote_rule(::Type{Float8},::Type{<:Integer}) = Float8

?

@milankl milankl linked a pull request Feb 6, 2023 that will close this issue
@milankl
Copy link
Member

milankl commented Feb 6, 2023

Released as v0.1.1

@bjarthur
Copy link
Author

bjarthur commented Feb 6, 2023

thanks so much! i was going to offer to submit a PR, but you beat me to it.

@milankl
Copy link
Member

milankl commented Feb 6, 2023

I wrote this package years ago for a project but never used it since, glad that it's still useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants