MCPcopy Create free account
hub / github.com/comaps/comaps / TestMaxULPs

Function TestMaxULPs

libs/base/base_tests/math_test.cpp:23–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22template <typename Float>
23void TestMaxULPs()
24{
25 for (unsigned int logMaxULPs = 0; logMaxULPs <= 8; ++logMaxULPs)
26 {
27 unsigned int const maxULPs = (1 << logMaxULPs) - 1;
28 for (int base = -1; base <= 1; ++base)
29 {
30 for (int dir = -1; dir <= 1; dir += 2)
31 {
32 Float const x = base;
33 Float y = x;
34 for (unsigned int i = 0; i <= maxULPs; ++i)
35 {
36 TEST(AlmostEqualULPs(x, y, maxULPs), (x, y, maxULPs, x - y, dir));
37 Float const nextY = NextFloat(y, dir);
38 TEST_NOT_EQUAL(y, nextY, (i, base, dir));
39 y = nextY;
40 }
41 TEST(!AlmostEqualULPs(x, y, maxULPs), (x, y, maxULPs, x - y));
42 }
43 }
44 }
45}
46} // namespace
47
48UNIT_TEST(round_lround_smoke)

Callers

nothing calls this directly

Calls 3

TESTFunction · 0.85
NextFloatFunction · 0.85
AlmostEqualULPsFunction · 0.50

Tested by

no test coverage detected