// filename:c2011-3-20-ex.c // original examples and/or notes: // (c) ISO/IEC JTC1 SC22 WG14 N1570, April 12, 2011 // C2011 C2011 3.20 ceiling, 3.21 floor : Example // 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 #include int main(void) { //3.20 // ⎡x⎤ // ceiling of x: the least integer greater than or equal to x // EXAMPLE ⎡2. 4⎤ is 3, ⎡−2. 4⎤ is −2. //3.21 // ⎣x⎦ //floor of x: the greatest integer less than or equal to x // EXAMPLE ⎣2. 4⎦ is 2, ⎣−2. 4⎦ is −3. signed int a,b,c,d,e; a = ceil(2.4) ; b = ceil(-2.4) ; c = floor(2.4) ; d = floor(-2.4) ; printf("C2011 3.20 ceiling, 3.21 floor : Example %d %d %d %d", a,b,c,d); } // output may be //C2011 3.20 ceiling, 3.21 floor : Example 3 -2 2 -3o