| 45 | } |
| 46 | |
| 47 | void |
| 48 | testBits (float f, const char bh[19], const char bg[35]) |
| 49 | { |
| 50 | half h (f); |
| 51 | float g (h); |
| 52 | |
| 53 | cout.width (15); |
| 54 | cout.precision (8); |
| 55 | cout << f << " "; |
| 56 | printBits (cout, f); |
| 57 | cout << " "; |
| 58 | printBits (cout, h); |
| 59 | cout << '\n'; |
| 60 | cout.width (15); |
| 61 | cout << g << " "; |
| 62 | printBits (cout, g); |
| 63 | cout << "\n\n"; |
| 64 | |
| 65 | if (bh || bg) |
| 66 | { |
| 67 | char ch[19], cg[35]; |
| 68 | |
| 69 | printBits (ch, h); |
| 70 | printBits (cg, g); |
| 71 | |
| 72 | if (!equalBitPatterns (ch, bh)) |
| 73 | { |
| 74 | cout << "error: expected " << bh << ", got " << ch << endl; |
| 75 | assert (false); |
| 76 | } |
| 77 | |
| 78 | if (!equalBitPatterns (cg, bg)) |
| 79 | { |
| 80 | cout << "error: expected " << bg << ", got " << cg << endl; |
| 81 | assert (false); |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | float |
| 87 | floatPosInfinity () |
no test coverage detected