Skip to content

Automatically strip unitless values #128

@haberdashPI

Description

@haberdashPI

I would have expected this expression to evaluate to a unitless value:

julia> using Unitful: s, Hz
julia> x = 10s * 2Hz
20 Hz s

Instead, one has to do

julia> using Unitful: s, Hz
julia> x = uconvert(unit(1),10s * 2Hz)
20//1

In small expressions this is plenty readable, but in large expressions it gets somewhat ugly. How feasible is that to change? I'd like this to work because then it becomes fairly natural to work with unitful values in larger expressions of unitless values. If this is a reasonable change, I'd be happy to create a pull request if I can be pointed in the right direction.

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