JuliaPhysics / JuliaPhysics/Unitful.jl
Automatically strip unitless values
- Dominant language
- Julia
- Stars
- 675
- Forks
- 124
- Avg merge
- 3h 38m
- Merged PRs (30d)
- 1
Description
I would have expected this expression to evaluate to a unitless value:
```julia
julia> using Unitful: s, Hz
julia> x = 10s * 2Hz
20 Hz s
```
Instead, one has to do
```julia
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the Julia expressions in the issue and trace Unitful's arithmetic and unit-conversion implementation. Determine where products with cancelling units could become unitless, and define tests showing that 10s * 2Hz evaluates to 20//1 without changing expressions whose units do not cancel.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100