// filename:c2011-7-6-1-ex.c // original examples and/or notes: // (c) ISO/IEC JTC1 SC22 WG14 N1570, April 12, 2011 // C2011 7.6.1 The FENV_ACCESS pragma // compile and output mechanism: // (c) Ogawa Kiyoshi, kaizen@gifu-u.ac.jp, December.29, 2013 // compile errors and/or wornings: // (c) Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn) // Target: x86_64-apple-darwin11.4.2 //Thread model: posix // (c) LLVM 2003-2009 University of Illinois at Urbana-Champaign. #include // Example #include void f(double x) { #pragma STDC FENV_ACCESS ON void g(double); void h(double); /* ... */ g(x + 1); h(x + 1); /* ... */ } void g(double d){ d=d*d; printf("%f\n",d); } void h(double d){ d=d*d*d; printf("%f\n",d); } int main(void) { f(0.5); return printf("7.6.1 The FENV_ACCESS pragma\n"); } // warning may be // c2011-7-6-1-ex.c:17:14: warning: pragma STDC FENV_ACCESS ON is not supported, ignoring pragma [-Wunknown-pragmas] //#pragma STDC FENV_ACCESS ON // ^ //1 warning generated. // output may be //2.250000 //3.375000 // 7.6.1 The FENV_ACCESS pragma