Full precision not respected in some cases
Summary
The Eigen::FullPrecision bit is not respected in my cases. I got the same output while the input double of two Eigen matrix has about 3 ULP difference.
Environment
- Operating System : Linux
- Architecture : x64
- Eigen Version : 3.4.0
- Compiler Version : Gcc9.4
- Compile Flags : -mno-avx512f -fopenmp -O2 -g -DNDEBUG -fPIC -fdiagnostics-color=always -fPIC -mfpmath=sse -msse -msse2 -msse3 -mssse3 -std=c++17
- Vector Extension : SSE
Minimal Example
//show your code here
#include <Eigen/Dense>
#include <fmt/format.h>
#include <iostream>
int main() {
Eigen::Matrix4d a, b;
a << 0.86602540001429662, -0.50000000653007737, 0, 0,
0.50000000653007737, 0.86602540001429662, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1;
b << 0.86602540001429695, -0.50000000653007703, 0, 0,
0.50000000653007703, 0.86602540001429695, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1;
Eigen::IOFormat matrix_format(Eigen::FullPrecision);
std::cout << "A:\n" << a.format(matrix_format) << "\n";
std::cout << "B:\n" << b.format(matrix_format) << "\n";
std::cout << fmt::format("{} {}", a(0), b(0));
return 0;
}
Steps to reproduce
- run demo online
What is the current bug behavior?
The output of two matrices with full precision format are the same.
What is the expected correct behavior?
The output of two matrices with full precision format are different. Also, outputted matrix elements are in double precision(IEEE-754).
Relevant logs
A:
0.866025400014297 -0.500000006530077 0 0
0.500000006530077 0.866025400014297 0 0
0 0 1 0
0 0 0 1
B:
0.866025400014297 -0.500000006530077 0 0
0.500000006530077 0.866025400014297 0 0
0 0 1 0
0 0 0 1
0.8660254000142966 0.866025400014297
Warning Messages
Benchmark scripts and results
Anything else that might help
-
Have a plan to fix this issue.
Edited by Yingnan Wu