ICU-21366 testConverter: allow some double-precision error for 0.0
See #1443
diff --git a/icu4c/source/test/intltest/units_test.cpp b/icu4c/source/test/intltest/units_test.cpp
index c023070..c88116a 100644
--- a/icu4c/source/test/intltest/units_test.cpp
+++ b/icu4c/source/test/intltest/units_test.cpp
@@ -247,9 +247,12 @@
continue;
}
+ double maxDelta = 1e-6 * uprv_fabs(testCase.expectedValue);
+ if (testCase.expectedValue == 0) {
+ maxDelta = 1e-12;
+ }
assertEqualsNear(UnicodeString("testConverter: ") + testCase.source + " to " + testCase.target,
- testCase.expectedValue, converter.convert(testCase.inputValue),
- 0.0001 * uprv_fabs(testCase.expectedValue));
+ testCase.expectedValue, converter.convert(testCase.inputValue), maxDelta);
}
}