JuliaPhysics / JuliaPhysics/Unitful.jl

`div` treats plain numbers and unitless quantities differently

Open
#585 0 comments 0 reactions 0 assignees View on GitHub
dimensionless
Dominant language
Julia
Stars
675
Forks
124
Avg merge
3h 38m
Merged PRs (30d)
1

Description

This package usually treats plain numbers like `3` and quantities without units (i.e., with the `NoUnits` unit) the same. But `div` doesn’t when the other argument is a dimensionful quantity:
```julia
julia> x = 3
3

julia> y = Quantity{Int, NoDims, typeof(NoUnits)}(3)
3

julia> div(10u"m", x)
3 m

julia> div(10u"m", y)
ERROR: DimensionError: and m are not dimensionally compatible.
Stacktrace:
[...]
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Julia REPL examples and tracing the `div` dispatch involving `Quantity`, `NoUnits`, and dimensionful quantities. Compare the paths for a plain number and a unitless quantity, then verify that both cases behave consistently when dividing `10u"m"`.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.