-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Labels
logarithmiclogarithmic scales (decibels, nepers, …)logarithmic scales (decibels, nepers, …)
Description
Hi, thank you for this wonderful package!
Here's the thing, I can construct a Level
:
y = Unitful.Level{Unitful.Decibel,1}(2);
But I can't show it:
julia> y
Error showing value of type Level{Unitful.LogInfo{:Decibel, 10, 10}, 1, Int64}:
ERROR: undefined behavior. Please file an issue with the code needed to reproduce.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] isrootpower_dim(y::Unitful.Dimensions{()})
@ Unitful ~/.julia/packages/Unitful/dHMk1/src/logarithm.jl:167
[3] isrootpower(y::Int64)
@ Unitful ~/.julia/packages/Unitful/dHMk1/src/logarithm.jl:166
[4] tolog(L::Type{Unitful.LogInfo{:Decibel, 10, 10}}, S::Int64, x::Float64)
@ Unitful ~/.julia/packages/Unitful/dHMk1/src/logarithm.jl:82
[5] ustrip(x::Level{Unitful.LogInfo{:Decibel, 10, 10}, 1, Int64})
@ Unitful ~/.julia/packages/Unitful/dHMk1/src/logarithm.jl:162
[6] show(io::IOContext{Base.TTY}, x::Level{Unitful.LogInfo{:Decibel, 10, 10}, 1, Int64})
@ Unitful ~/.julia/packages/Unitful/dHMk1/src/logarithm.jl:314
[7] show(io::IOContext{Base.TTY}, ::MIME{Symbol("text/plain")}, x::Level{Unitful.LogInfo{:Decibel, 10, 10}, 1, Int64})
@ Base.Multimedia ./multimedia.jl:47
...
A similar issue exists with:
x1 = @dB (-2u"V")/1u"V";
where I can construct it, but cannot show it.
Here, the issue is probably due to logarithmic scales not allowing negative values. In fact, this works perfectly:
julia> x2 = @dB (2u"V")/1u"V"
6.020599913279624 dBV
But then, the issue is that that x1
construction shouldn´t probably be allowed at all.
Metadata
Metadata
Assignees
Labels
logarithmiclogarithmic scales (decibels, nepers, …)logarithmic scales (decibels, nepers, …)