MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / testBits

Function testBits

src/ImathTest/testBitPatterns.cpp:47–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47void
48testBits (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
86float
87floatPosInfinity ()

Callers 1

testBitPatternsFunction · 0.85

Calls 2

printBitsFunction · 0.85
equalBitPatternsFunction · 0.85

Tested by

no test coverage detected