Skip to content

Always use truncated printing by default #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2019
Merged

Always use truncated printing by default #43

merged 1 commit into from
May 27, 2019

Conversation

giordano
Copy link
Member

@giordano giordano commented May 26, 2019

Use IOContext to control the behaviour.

Fix #40 @karlwessel

julia> using Measurements, Unitful

julia> x = pi ± (ℯ/100)
3.142 ± 0.027

julia> (x,)
(3.142 ± 0.027,)

julia> x * u"m"
3.142 ± 0.027 m

julia> println(IOContext(stdout, :error_digits=>0), x)
3.141592653589793 ± 0.02718281828459045

julia> println(IOContext(stdout, :error_digits=>1), x)
3.14 ± 0.03

julia> println(IOContext(stdout, :error_digits=>5), x)
3.141593 ± 0.027183

Use `IOContext` to control the behaviour.
@codecov-io
Copy link

codecov-io commented May 26, 2019

Codecov Report

Merging #43 into master will decrease coverage by 0.33%.
The diff coverage is 81.81%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #43      +/-   ##
=========================================
- Coverage   96.64%   96.3%   -0.34%     
=========================================
  Files          12      12              
  Lines         537     542       +5     
=========================================
+ Hits          519     522       +3     
- Misses         18      20       +2
Impacted Files Coverage Δ
src/show.jl 72.72% <81.81%> (-2.28%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6e3bef...acb8c8b. Read the comment docs.

@karlwessel
Copy link

Works like a charm:

julia> using Measurements

julia> a = 10π ± π
31.4 ± 3.1

julia> a, a
(31.4 ± 3.1, 31.4 ± 3.1)

Also in legends of plots and everywhere else where i tested.

Thank you!

@giordano
Copy link
Member Author

Cool, thanks for testing!

@giordano giordano merged commit d0bb303 into master May 27, 2019
@giordano giordano deleted the full-show branch May 27, 2019 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to always use truncated display of Measurements
3 participants