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

Fix Ambiguities #105

Merged
merged 3 commits into from
Feb 2, 2018
Merged

Fix Ambiguities #105

merged 3 commits into from
Feb 2, 2018

Conversation

andreasnoack
Copy link
Member

Fixes #101

Copy link
Member

@timholy timholy left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

src/fixed.jl Outdated
@@ -7,6 +7,9 @@ struct Fixed{T <: Signed,f} <: FixedPoint{T, f}
Fixed{T, f}(i::Integer, _) where {T,f} = new{T, f}(i % T)
Fixed{T, f}(x) where {T,f} = convert(Fixed{T,f}, x)
Fixed{T, f}(x::Fixed{T,f}) where {T,f} = x
Fixed{T, f}(x::Char) where {T,f} = throw(ArgumentError("Fixed cannot be constructed from a Char"))
Fixed{T, f}(x::Complex) where {T,f} = Fixed{T, f}(real(x))
Copy link
Member

Choose a reason for hiding this comment

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

real returns the real part even if there is a non-zero complex part. Would it be better to use convert and get the InexactError?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that is a blunder. The reason I ended here is that Complex{S}, for some reason, didn't match the ambiguous signature. Guess it will have to be Fixed{T, f}(convert(real(eltype(x)), x)). Will push a fix.

@codecov-io
Copy link

codecov-io commented Feb 1, 2018

Codecov Report

Merging #105 into master will increase coverage by 0.26%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #105      +/-   ##
=========================================
+ Coverage   91.44%   91.7%   +0.26%     
=========================================
  Files           4       4              
  Lines         187     193       +6     
=========================================
+ Hits          171     177       +6     
  Misses         16      16
Impacted Files Coverage Δ
src/normed.jl 97.75% <100%> (+0.07%) ⬆️
src/fixed.jl 100% <100%> (ø) ⬆️

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 25affc6...d91de9e. Read the comment docs.

@andreasnoack
Copy link
Member Author

I think it should be ready now. I've also added some tests.

@timholy timholy merged commit 861b036 into master Feb 2, 2018
@timholy
Copy link
Member

timholy commented Feb 2, 2018

Great, thanks again!

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.

3 participants