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

Add Base.round(x::IrrationalConstant, r::RoundingMode) #24

Merged
merged 5 commits into from
Feb 24, 2023

Conversation

hyrodium
Copy link
Contributor

This PR fixes #23.

Before this PR

julia> using IrrationalConstants 
[ Info: Precompiling IrrationalConstants [92d709cd-6900-40b7-9082-c6be49f344b6]

julia> round(twoπ)
ERROR: MethodError: no method matching round(::IrrationalConstants.Twoπ, ::RoundingMode{:Nearest})
Closest candidates are:
  round(::Real, ::RoundingMode; digits, sigdigits, base) at floatfuncs.jl:128
  round(::Union{Float16, Float32, Float64}, ::RoundingMode{:Nearest}) at float.jl:370
  round(::Integer, ::RoundingMode) at floatfuncs.jl:157
  ...

After this PR

julia> using IrrationalConstants

julia> round(twoπ)
6.0

I have not added tests yet because not to make conflicts with #22.

@coveralls
Copy link

coveralls commented Feb 23, 2023

Pull Request Test Coverage Report for Build 4253675818

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-2.6%) to 97.368%

Files with Coverage Reduction New Missed Lines %
src/macro.jl 1 96.97%
Totals Coverage Status
Change from base Build 4223760967: -2.6%
Covered Lines: 37
Relevant Lines: 38

💛 - Coveralls

@codecov
Copy link

codecov bot commented Feb 23, 2023

Codecov Report

Base: 97.36% // Head: 97.43% // Increases project coverage by +0.06% 🎉

Coverage data is based on head (c8867ff) compared to base (1275225).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #24      +/-   ##
==========================================
+ Coverage   97.36%   97.43%   +0.06%     
==========================================
  Files           2        2              
  Lines          38       39       +1     
==========================================
+ Hits           37       38       +1     
  Misses          1        1              
Impacted Files Coverage Δ
src/macro.jl 97.36% <100.00%> (+0.07%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@devmotion devmotion 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 it's important to fix this regression, so I merged the main branch and added some tests. Thanks @hyrodium, feel free to make a follow-up PR if you are unhappy with any of these final changes!

@devmotion devmotion merged commit 6ecf42b into JuliaMath:main Feb 24, 2023
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.

round is broken after v0.2.0 release
3 participants