MCPcopy Create free account
hub / github.com/AnswerDotAI/gpu.cpp / main

Function main

numeric_types/half.cpp:244–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244int main() {
245 printf("\nHalf-precision float tests\n==========================\n");
246
247 printf("\nRegular values float round trips\n\n");
248 testRoundTrip(1.0f);
249 testRoundTrip(0.5f);
250 testRoundTrip(2.0f);
251 testRoundTrip(3.14f);
252 testRoundTrip(-1.0f);
253 testRoundTrip(-0.5f);
254 testRoundTrip(-2.0f);
255 testRoundTrip(-3.14f);
256
257 printf("\nEdge Case float round trips\n\n");
258 testRoundTrip(0.0f);
259 testRoundTrip(-0.0f);
260 testRoundTrip(INFINITY);
261 testRoundTrip(-INFINITY);
262 testRoundTrip(NAN);
263 // testRoundTrip(FLT_MAX); // since FLT_MAX is not representable as half it
264 // is not expected to round-trip correctly testRoundTrip(FLT_MIN);
265 testRoundTrip(FLT_TRUE_MIN);
266
267 printf("\nSpecial half values\n\n");
268 testSpecialCases();
269
270 printf("\nContainers and CPU/GPU round trip\n\n");
271 testContainers();
272
273 printf("\nWGSL f16 extension test\n\n");
274 testWGSL();
275
276 printf("\nTests completed.\n");
277
278 return 0;
279}

Callers

nothing calls this directly

Calls 4

testRoundTripFunction · 0.85
testSpecialCasesFunction · 0.85
testContainersFunction · 0.85
testWGSLFunction · 0.85

Tested by

no test coverage detected