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

Function testBitPatterns

src/ImathTest/testBitPatterns.cpp:136–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134} // namespace
135
136void
137testBitPatterns ()
138{
139 cout << "specific bit patterns\n\n";
140
141 //
142 // Numbers close to 1.0
143 //
144
145 testBits (1.0f, "0 01111 0000000000", "0 01111111 00000000000000000000000");
146 testBits (
147 1.0f + HALF_EPSILON,
148 "0 01111 0000000001",
149 "0 01111111 00000000010000000000000");
150 testBits (
151 1.0f + HALF_EPSILON * 0.5f,
152 "0 01111 0000000000",
153 "0 01111111 00000000000000000000000");
154 testBits (
155 1.0f + HALF_EPSILON * 0.4999f,
156 "0 01111 0000000000",
157 "0 01111111 00000000000000000000000");
158 testBits (
159 1.0f + HALF_EPSILON * 0.5001f,
160 "0 01111 0000000001",
161 "0 01111111 00000000010000000000000");
162 testBits (
163 1.0f + HALF_EPSILON + HALF_EPSILON,
164 "0 01111 0000000010",
165 "0 01111111 00000000100000000000000");
166 testBits (
167 1.0f + HALF_EPSILON + HALF_EPSILON * 0.5f,
168 "0 01111 0000000010",
169 "0 01111111 00000000100000000000000");
170 testBits (
171 1.0f + HALF_EPSILON + HALF_EPSILON * 0.4999f,
172 "0 01111 0000000001",
173 "0 01111111 00000000010000000000000");
174 testBits (
175 1.0f + HALF_EPSILON + HALF_EPSILON * 0.5001f,
176 "0 01111 0000000010",
177 "0 01111111 00000000100000000000000");
178 testBits (
179 1.0f - HALF_EPSILON * 0.5f,
180 "0 01110 1111111111",
181 "0 01111110 11111111110000000000000");
182 testBits (
183 1.0f - HALF_EPSILON * 0.5f * 0.5f,
184 "0 01111 0000000000",
185 "0 01111111 00000000000000000000000");
186 testBits (
187 1.0f - HALF_EPSILON * 0.5f * 0.4999f,
188 "0 01111 0000000000",
189 "0 01111111 00000000000000000000000");
190 testBits (
191 1.0f - HALF_EPSILON * 0.5f * 0.5001f,
192 "0 01110 1111111111",
193 "0 01111110 11111111110000000000000");

Callers

nothing calls this directly

Calls 7

testBitsFunction · 0.85
floatPosInfinityFunction · 0.70
floatPosQNan1Function · 0.70
floatPosQNan2Function · 0.70
floatNegInfinityFunction · 0.70
floatNegQNan1Function · 0.70
floatNegQNan2Function · 0.70

Tested by

no test coverage detected