diff --git a/unittest/TestSplineTessellation.cpp b/unittest/TestSplineTessellation.cpp index 91a6210d9f..084ca6e7ab 100644 --- a/unittest/TestSplineTessellation.cpp +++ b/unittest/TestSplineTessellation.cpp @@ -358,8 +358,10 @@ bool CheckVertex(const TestCase &tc, const RefSurface &ref, const SimpleVertex & } } const D3 gotN = { got.nrm.x, got.nrm.y, got.nrm.z }; - const double dot = gotN.x * wantN.x + gotN.y * wantN.y + gotN.z * wantN.z; - if (!(fabs(gotN.Length() - 1.0) < 1e-4 && dot > 0.9999)) { + // The length only to rsqrt precision: x86 normalizes with a bare _mm_rsqrt_ps (relative error up to 3.7e-4). + const double gotLen = gotN.Length(); + const double dot = (gotN.x * wantN.x + gotN.y * wantN.y + gotN.z * wantN.z) / gotLen; + if (!(fabs(gotLen - 1.0) < 5e-4 && dot > 0.9999)) { printf("%s: vertex %d at (%.3f, %.3f): normal %f %f %f, want %f %f %f\n", tc.name, index, u, v, gotN.x, gotN.y, gotN.z, wantN.x, wantN.y, wantN.z); return false;