You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<fmt/format.h>
#include"output/cpp/symforce/sym/test_function.h"intmain() {
constdoubletime = 3.01;
auto v = sym::TestFunction(time);
fmt::print("time = {:>6}, v = {:>6}, {:>6}, {:>6}, {:>6}\n", time, v[0], v[1],
v[2], v[3]);
return0;
}
Observe that the numerical output is non-trivially different:
Mac version (resultant quaternion has zero norm):
time = 3.01, v = 0, 0, 0, 0
Linux version (resultant quaternion matches python code):
time = 3.01, v = 0, 0, -0.7052531588616179, 0.7089555570807733
NOTE: In this particular case, there may additionally be a bug in Rot3.from_rotation_matrix - the epsilon value is unused. This example just highlights how unpredictable behavior emerges from this issue.
Expected behavior
Ideally order of operations would be identical on all operating systems.
Environment
OS and version: Ubuntu 22.04, OSX Ventura
Python version: 3.8
SymForce Version 0.8
The text was updated successfully, but these errors were encountered:
This is a weird one - we had similar issues in the past when SymEngine was built with different implementations of std::unordered_map. I'm a little surprised we haven't seen this, we should definitely fix
NOTE: In this particular case, there may additionally be a bug in Rot3.from_rotation_matrix - the epsilon value is unused. This example just highlights how unpredictable behavior emerges from this issue.
Yep, good callout - this is not a bug but is definitely surprising - our current implementation of from_rotation_matrix doesn't require an epsilon, but we still have the argument mostly to not break the API. In general we aim for our generated code to be identical everywhere, and treat it as a bug if it's not, regardless of whether evaluated numerical results are meaningfully different
Describe the bug
Operations are placed in a different order on different platforms. This can result in unexpected numerical issues in some cases.
Testing details:
Ubuntu 22.04, Python 3.8.16, x86
OSX Ventura 13.3.1, Python 3.8.16, Apple M2/ARM
v0.8.0
, installed from pipTo Reproduce
world_R_body_subbed
andquat_elements_subbed
)time=3.01
:NOTE: In this particular case, there may additionally be a bug in
Rot3.from_rotation_matrix
- the epsilon value is unused. This example just highlights how unpredictable behavior emerges from this issue.Expected behavior
Ideally order of operations would be identical on all operating systems.
Environment
The text was updated successfully, but these errors were encountered: