1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6 #include <math.h> 7 8 float roundf(float x)9roundf (float x) 10 { 11 float res; 12 if (x >= 0.0F) 13 { 14 res = ceilf (x); 15 if (res - x > 0.5F) 16 res -= 1.0F; 17 } 18 else 19 { 20 res = ceilf (-x); 21 if (res + x > 0.5F) 22 res -= 1.0F; 23 res = -res; 24 } 25 return res; 26 } 27