// compute and check pi and s2 constants // // R. Perry, August 2019 // #include #include const double xpi = 0x1.921fb54442d18p+1, xs2 = 0x1.6a09e667f3bcdp-1; int main( void) { double pi = 4*atan(1), s2 = sqrt(2)/2; printf( "const double pi = %a; // %.18g = 4*atan(1)\n", pi, pi); printf( "const double s2 = %a; // %.18g = sqrt(2)/2\n", s2, s2); if( pi != xpi || s2 != xs2) printf( "bad\n"); }