Skip to content

Conversation

@KristofferC
Copy link
Collaborator

@KristofferC KristofferC commented Mar 18, 2017

The methods gave the wrong partials but this was not noticed in the tests because == only compares the value part:

julia> x, y, z = Dual(1,1,2,3), Dual(2,4,5,6), Dual(3,7,8,9);

julia> x*y + z - fma(x, y, z)
Dual(0,-3,-3,-3)

Fix the bug and introduce a dualapprox function to test approximate results of both the value and partial part:

julia> x, y, z = Dual(1,1,2,3), Dual(2,4,5,6), Dual(3,7,8,9);

julia> x*y + z - fma(x, y, z)
Dual(0,0,0,0)

cc @tpapp

@mlubin
Copy link
Contributor

mlubin commented Mar 18, 2017

I'm guessing the commit of partials.jl.mem was not intentional?

@KristofferC
Copy link
Collaborator Author

Jeez, it's up for 15 seconds and someone notices.. :P

@KristofferC KristofferC mentioned this pull request Mar 18, 2017
test/DualTest.jl Outdated
# exponent by one
intrand(T) = T == Int ? rand(2:10) : rand(T)

dualapprox(A, B) = value(A) value(B) && partials(A) partials(B)
Copy link
Member

Choose a reason for hiding this comment

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

The (outdated-ly named) test_approx_diffnums defined below is what is used for this in the rest of the tests. Can you reuse/rename/rewrite that function instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, didn't notice it.

@jrevels jrevels merged commit accc294 into master Mar 24, 2017
@jrevels jrevels deleted the kc/fix_fma branch March 24, 2017 18:03
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