Skip to content

Dividing a Unitful Range by a unit gives a vector #846

@jonathanlilly

Description

@jonathanlilly

Hello,

First of all thank you for this fantastic package.

I noticed a surprising behavior. (1:10)*m is a UnitRange, as are (1:10)mm and (1:10)ms, but (1:10)m/s is a Vector. (1:10)(m/s) is on the other hand still a UnitRange.

For some reason when the Range is divided by a unit it becomes a Vector. This does not happen for multiplication. Is this the desired behavior?

One reason this matters is for display, since Vectors don't avail themselves to a nice show method:

julia> show((1:10)*(m/s))
(1:10) m s⁻¹
julia> show((1:10)*m/s)
Quantity{Int64, 𝐋 𝐓⁻¹, Unitful.FreeUnits{(m, s⁻¹), 𝐋 𝐓⁻¹, nothing}}[1 m s⁻¹, 2 m s⁻¹, 3 m s⁻¹, 4 m s⁻¹, 5 m s⁻¹, 6 m s⁻¹, 7 m s⁻¹, 8 m s⁻¹, 9 m s⁻¹, 10 m s⁻¹]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions