Skip to content

Fix ldexp test errors - #568

Merged
devmotion merged 1 commit into
masterfrom
dw/fix_tests
Dec 13, 2021
Merged

Fix ldexp test errors#568
devmotion merged 1 commit into
masterfrom
dw/fix_tests

Conversation

@devmotion

Copy link
Copy Markdown
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:144ldexp(::ForwardDiff.Dual{Tx}, ::Real) where Tx at ~/.julia/packages/ForwardDiff/tZ5o1/src/dual.jl:144ldexp(::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...

Comment threadtest/DualTest.jl
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
Copy Markdown
MemberAuthor

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

codecov-commenter commented Dec 13, 2021

Copy link
Copy Markdown

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 FilesCoverage Δ
src/dual.jl74.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 masterDec 13, 2021
@devmotion
devmotion deleted the dw/fix_tests branch December 13, 2021 00:29
Sign up for freeto 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

@devmotion@codecov-commenter@mcabbott