JuliaPhysics / JuliaPhysics/Unitful.jl

Wrong conversion from dimensionless `Quantity` to `Gain`

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

Description

using `convert`:
```julia
julia> convert(typeof(1.0u"dB_rp"), 100.0) # correct
40.0 dB

julia> convert(typeof(1.0u"dB_rp"), 1.0u"m/cm") # this should be the same, because 1m/cm == 100
100.0 dB
```
using `uconvert`:
```julia
julia> uconvert(u"dB_rp", 100.0) # correct
40.0 dB

julia> uconvert(u"dB_rp", 1.0u"m/cm") # a _different_ wrong result
0.0 dB
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the two `convert` and `uconvert` examples in Julia, then trace how dimensionless `Quantity` values are converted to `Gain`. Done means converting `1.0u"m/cm"` to `dB_rp` matches converting the equivalent numeric value and returns `40.0 dB`.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
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.