JuliaPhysics / JuliaPhysics/Unitful.jl
Promotion of Irrational and Float32 gives Float64 on Julia LTS
- Dominant language
- Julia
- Stars
- 675
- Forks
- 124
- Avg merge
- 3h 38m
- Merged PRs (30d)
- 1
Description
On the current Julia LTS version, I'm getting this.
```julia
julia> VERSION
v"1.10.9"
(unitful) pkg> status
Status `/private/tmp/unitful/Project.toml`
[1986cc42] Unitful v1.22.0
julia> promote(π, 1f0u"°")
(3.141592653589793, 0.01745329238474369)
```
This is inconsistent with unitless promotion.
```julia
julia> promote(π, 1f0)
(3.1415927f0, 1.0f0)
```
Curiously, this bug is not there if I use the same Unitful version on the current Julia release version.
```julia
julia> VERSION
v"1.11.5"
(unitful) pkg> status
Status `/private/tmp/unitful/Project.toml`
[1986cc42] Unitful v1.22.0
julia> promote(π, 1f0u"°")
(3.1415927f0, 0.017453292f0)
```
I tried looking into what exactly is going wrong here, but the promotion machinery is pretty tough to wrap my head around....
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the promotion examples from the issue on Julia 1.10.9 and 1.11.5 with Unitful v1.22.0. Start by tracing Julia's promotion machinery for irrational values, Float32, and unitful degrees; done means the Julia LTS result preserves the Float32 promotion behavior shown for unitless values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100