1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
# define TGSOURCE "lrint.c" #include "_tgmath.h" #include <math.h> #include <limits.h> #include <fenv.h> long int TGFN(lrint)(TYPE x) { switch (fpclassify(x)) { case FP_ZERO: return 0; case FP_INFINITE: feraiseexcept(FE_INVALID); return signbit(x) ? LONG_MIN : LONG_MAX; default: break; } return x; } /* STDC(199901) LINK(m) */