MCPcopy Create free account
hub / github.com/boostorg/json / within_1ulp

Method within_1ulp

test/double.cpp:70–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 };
69
70 bool
71 within_1ulp(double x, double y)
72 {
73 std::uint64_t bx, by;
74 std::memcpy(&bx, &x, sizeof(x));
75 std::memcpy(&by, &y, sizeof(y));
76
77 auto diff = bx - by;
78 switch (diff)
79 {
80 case 0:
81 case 1:
82 case 0xffffffffffffffff:
83 return true;
84 default:
85 break;
86 }
87 return false;
88 }
89
90 static
91 value

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected