| 610 | }; |
| 611 | |
| 612 | bool |
| 613 | within_1ulp(double x, double y) |
| 614 | { |
| 615 | std::uint64_t bx, by; |
| 616 | std::memcpy(&bx, &x, sizeof(x)); |
| 617 | std::memcpy(&by, &y, sizeof(y)); |
| 618 | |
| 619 | auto diff = bx - by; |
| 620 | switch (diff) |
| 621 | { |
| 622 | case 0: |
| 623 | case 1: |
| 624 | case 0xffffffffffffffff: |
| 625 | return true; |
| 626 | default: |
| 627 | break; |
| 628 | } |
| 629 | return false; |
| 630 | } |
| 631 | |
| 632 | // Verify that f converts to the |
| 633 | // same double produced by `strtod`. |
nothing calls this directly
no outgoing calls
no test coverage detected