Skip to content

Commit

Permalink
Fix bug in pretty printing of CIs with negative values
Browse files Browse the repository at this point in the history
  • Loading branch information
brenhinkeller committed Apr 2, 2023
1 parent d5b1940 commit 63055ff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Isoplot"
uuid = "5adc30d5-9ddf-423c-bb15-ece697bec3ab"
authors = ["C. Brenhin Keller <[email protected]>"]
version = "0.2.4"
version = "0.2.5"

[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand Down
2 changes: 1 addition & 1 deletion src/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ end
function Base.print(io::IO, x::CI)
l = round(x.mean - x.lower, sigdigits=3)
u = round(x.upper - x.mean, sigdigits=3)
d = floor(Int, log10(x.mean)) - floor(Int, log10(max(l,u)))
d = floor(Int, log10(abs(x.mean))) - floor(Int, log10(max(abs(l),abs(u))))
m = round(x.mean, sigdigits=3+d)
print(io, "$m +$u/-$l")
end
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ using Measurements
@test ci == CI{Float64}(5.5, 3.0276503540974917, 5.5, 1.225, 9.775)
@test "$ci" === "5.5 +4.28/-4.28"
@test display(ci) != NaN

ci = CI(randn(100))
@test display(ci) != NaN
end

@testset "General" begin
Expand Down

2 comments on commit 63055ff

@brenhinkeller
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register
Release notes:

  • Add all the decay constants!
  • Use Measurements.jl when converting half lives to λs
  • Export val and err
  • Fix bug in pretty printing of CIs with negative values

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/80859

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.5 -m "<description of version>" 63055ff71bdc1ea1054c858634f94de664ba6f9a
git push origin v0.2.5

Please sign in to comment.