Skip to content

Promotion of Irrational and Float32 gives Float64 on Julia LTS #778

@ettersi

Description

@ettersi

On the current Julia LTS version, I'm getting this.

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> 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> 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....

Metadata

Metadata

Assignees

No one assigned

    Labels

    floating-pointquantities based on floating-point numbers of different precision

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions