Skip to content

Fix ldexp test errors #568

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
Dec 13, 2021
Merged

Fix ldexp test errors #568

merged 1 commit into from
Dec 13, 2021

Conversation

devmotion
Copy link
Member

This PR fixes the test error caused by JuliaDiff/DiffRules.jl#73:

julia>] test ForwardDiff
...
...auto-testing Base.ldexp with 2 arguments
ERROR: LoadError: MethodError: no method matching ldexp(::Int64, ::Float64)
Closest candidates are:
  ldexp(::ForwardDiff.Dual{Tx}, ::AbstractFloat) where Tx at ~/.julia/packages/ForwardDiff/tZ5o1/src/dual.jl:144
  ldexp(::ForwardDiff.Dual{Tx}, ::Real) where Tx at ~/.julia/packages/ForwardDiff/tZ5o1/src/dual.jl:144
  ldexp(::Integer, ::ForwardDiff.Dual{Ty}) where Ty at ~/.julia/packages/ForwardDiff/tZ5o1/src/dual.jl:145
  ...
Stacktrace:
 [1] ldexp(x::ForwardDiff.Dual{Main.DualTest.TestTag(), Int64, 1}, y::Float64)
   @ ForwardDiff ~/.julia/packages/ForwardDiff/tZ5o1/src/dual.jl:243
...

x, y = if f === :ldexp
rand(), rand(1:10)
elseif f === :mod
13 + rand(), 5 + rand() # make sure x/y is not an integer
Copy link
Member Author

Choose a reason for hiding this comment

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

Random values where x/y where (close to) an integer caused problems in DiffRules (JuliaDiff/DiffRules.jl#78), so I thought it's good to apply the same fix here as well.

@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2021

Codecov Report

Merging #568 (6268c6c) into master (ab0e239) will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #568      +/-   ##
==========================================
+ Coverage   85.36%   85.38%   +0.01%     
==========================================
  Files           9        9              
  Lines         868      869       +1     
==========================================
+ Hits          741      742       +1     
  Misses        127      127              
Impacted Files Coverage Δ
src/dual.jl 74.83% <0.00%> (+0.08%) ⬆️

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 ab0e239...6268c6c. Read the comment docs.

@devmotion devmotion merged commit 01a056d into master Dec 13, 2021
@devmotion devmotion deleted the dw/fix_tests branch December 13, 2021 00:29
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