MCPcopy Create free account
hub / github.com/boostorg/json / testWithinULP

Method testWithinULP

test/double.cpp:416–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414 }
415
416 void
417 testWithinULP()
418 {
419 std::mt19937_64 rng;
420
421 checkAccuracy("10199214983525025199.13135016100190689227e-308", 2);
422
423 for( int i = 0; i < 1000000; ++i )
424 {
425 unsigned long long x1 = rng();
426 unsigned long long x2 = rng();
427 int x3 = std::uniform_int_distribution<>( -308, +308 )( rng );
428
429 char buffer[ 128 ];
430 sprintf( buffer, "%llu.%llue%d", x1, x2, x3 );
431
432 parse_options precise;
433 precise.numbers = number_precision::precise;
434 checkAccuracy( buffer, 2 );
435 checkAccuracy( buffer, 0, precise );
436 }
437
438 for( int i = -326; i <= +309; ++i )
439 {
440 char buffer[ 128 ];
441 sprintf( buffer, "1e%d", i );
442
443 checkAccuracy( buffer, 0 );
444 }
445 }
446
447 void
448 testExtraPrecision()

Callers

nothing calls this directly

Calls 1

sprintfFunction · 0.85

Tested by

no test coverage detected