-
Notifications
You must be signed in to change notification settings - Fork 9
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
Incorrect projection_weights
results due to floating point rounding error
#17
Comments
Starting to look at this. In 845e5ca I added a failing test case based on your example. One interesting thing is that it matters whether that test set is the first in the |
Test also fails on Julia master (Version 1.3.0-DEV.435, JuliaLang/julia@75c10e435b). Also tried a debug build of Julia ( |
Everything is OK with |
So if you change the @inline function mydot(x::SVector{2}, y::SVector{2})
@inbounds return x[1] * y[1] + x[2] * y[2]
end then everything is fine. But this function produces the exact same machine instructions as the StaticArrays |
Maybe it's not a corruption/miscompilation issue. It could just be the fact that there's a floating point comparison to 0 here: EnhancedGJK.jl/src/johnson_distance.jl Line 96 in 59a9200
and with the SIMD loop you get a slightly different result for the dot products, which end up being close to zero for this example (e.g. |
Also the |
Thanks for figuring that out! I understand now that my debugging statements were preventing the SIMD instructions from being emitted. I did see the |
Thank you for the reproducer and the initial digging. |
Fix #17, incorrect results due to switch to SIMD loop in StaticArrays' dot implementation
projection_weights
results due to floating point rounding error
Ahh, good catch. Sorry for my sloppy floating-point code! |
I am getting incorrect results from the package with the latest version (
Manifest.toml
andProject.toml
are attached). I haven't been able to figure out why, butprojection_weights
gives different answers from what it used to return.To make things really fun, when I instrument the
projection_weights_impl
to print or track values, it seems to give the correct result.Running the above file gives the incorrect result
This is happening on both Julia 1.1.0 and 1.2rc.
Here are the Manifest.toml and Project.toml
BadGJK.zip
The text was updated successfully, but these errors were encountered: