JuliaPhysics / JuliaPhysics/Unitful.jl
Quantities should be <: Real?
- Dominant language
- Julia
- Stars
- 675
- Forks
- 124
- Avg merge
- 3h 38m
- Merged PRs (30d)
- 1
Description
Currently, Unitful quantities are <: Number but not <: Real. This hinders composability with other libraries.
Just a few examples for methods that accept Reals and don't work with units - but actually should and totally make sense:
- `Base.searchsorted(::AbstractRange{<:Real}, ::Real)` does division instead of performing binary search - so, it's faster than AbstractArray fallback
- `StatsBase.weights` require `AbstractVector{<:Real}`
Surely there are much more.
Note that these methods are correctly restricted to reals: they don't make sense for complex numbers.
Why not make Quantity <: Real, and use Complex{Quantity} for complex unitful values?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.