Skip to content
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

Rewrite display.jl #210

Merged
merged 11 commits into from
Feb 20, 2017
Merged

Rewrite display.jl #210

merged 11 commits into from
Feb 20, 2017

Conversation

dpsanders
Copy link
Member

@dpsanders dpsanders commented Feb 18, 2017

Fixes #202, #175, #131.

This changes the name of displaymode to setdisplay, and the syntax to the simpler

setdisplay(:full)

instead of the wordy

displaymode(format=:full)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 90.293% when pulling 7d966bd on rewrite_display into 69bd570 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 90.293% when pulling 7d966bd on rewrite_display into 69bd570 on master.

@codecov-io
Copy link

codecov-io commented Feb 19, 2017

Codecov Report

Merging #210 into master will decrease coverage by -0.18%.
The diff coverage is 75%.

@@            Coverage Diff             @@
##           master     #210      +/-   ##
==========================================
- Coverage   90.45%   90.28%   -0.18%     
==========================================
  Files          23       23              
  Lines         985      988       +3     
==========================================
+ Hits          891      892       +1     
- Misses         94       96       +2
Impacted Files Coverage Δ
src/ValidatedNumerics.jl 100% <ø> (ø)
src/display.jl 93.15% <75%> (-2.57%)

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 69bd570...d11723e. Read the comment docs.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 90.293% when pulling 5e1c331 on rewrite_display into 69bd570 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 90.293% when pulling 5e1c331 on rewrite_display into 69bd570 on master.

@coveralls
Copy link

coveralls commented Feb 20, 2017

Coverage Status

Coverage decreased (-0.06%) to 90.394% when pulling 3c5b191 on rewrite_display into 69bd570 on master.

Copy link
Member

@lbenet lbenet left a comment

Choose a reason for hiding this comment

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

I think this can be merged right away. Yet, I have four comments, which are certainly not mandatory, but it is the right time to ask.

src/display.jl Outdated
@@ -23,8 +23,13 @@ The following options are available:
- `sigfigs`: number of significant figures to show in `standard` mode
Copy link
Member

Choose a reason for hiding this comment

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

I think it is worth writing here that the default number is 6.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, done.

src/display.jl Outdated
"""
function displaymode(;decorations=nothing, format=nothing, sigfigs=-1)
function setdisplay(format=nothing; decorations=nothing, sigfigs::Integer=-1)
Copy link
Member

Choose a reason for hiding this comment

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

I guess there is a reason why the default is nothing for each kw, but why is this better than setting them directly to the values specified in display_params?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good idea, thanks.

src/display.jl Outdated

else
throw(ArgumentError("`decorations` must be `true` or `false`"))
end
end

if sigfigs >= 0
Copy link
Member

Choose a reason for hiding this comment

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

What is the meaning of sigfigs=0? Anywhay, I get the following:

julia> @interval(0.1, 0.2)
[0.0999999, 0.200001]

julia> setdisplay(:standard, sigfigs=0)
0

julia> @interval(0.1, 0.2)
[0.09, 0.3]

Copy link
Member Author

Choose a reason for hiding this comment

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

I have made 1 the minimum value of sigfigs.

@@ -133,6 +146,9 @@ function subscriptify(n::Int)
end


# fall-back:
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need basic_representation and representation, or isn't it enough with one function and several methods?

Copy link
Member Author

Choose a reason for hiding this comment

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

I had just representation before. The problem is that representation(x::Interval{BigFloat}) calls representation for the interval part and then adds the part with the number of digits.

To do so, I had to use invoke, which is ugly. The simple solution was to add basic_representation instead.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation.

@dpsanders
Copy link
Member Author

I have made the changes you suggested, thanks. I'll merge once it goes green.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 90.283% when pulling d11723e on rewrite_display into 69bd570 on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 90.283% when pulling d11723e on rewrite_display into 69bd570 on master.

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.

4 participants