source: azure_iot_hub/trunk/musl-1.1.18/src/math/lrintl.c@ 388

Last change on this file since 388 was 388, checked in by coas-nagasima, 5 years ago

Azure IoT Hub Device C SDK を使ったサンプルの追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csrc
File size: 672 bytes
Line 
1#include <limits.h>
2#include <fenv.h>
3#include "libm.h"
4
5
6#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
7long lrintl(long double x)
8{
9 return lrint(x);
10}
11#elif defined(FE_INEXACT)
12/*
13see comments in lrint.c
14
15Note that if LONG_MAX == 0x7fffffffffffffff && LDBL_MANT_DIG == 64
16then x == 2**63 - 0.5 is the only input that overflows and
17raises inexact (with tonearest or upward rounding mode)
18*/
19long lrintl(long double x)
20{
21 #pragma STDC FENV_ACCESS ON
22 int e;
23
24 e = fetestexcept(FE_INEXACT);
25 x = rintl(x);
26 if (!e && (x > LONG_MAX || x < LONG_MIN))
27 feclearexcept(FE_INEXACT);
28 /* conversion */
29 return x;
30}
31#else
32long lrintl(long double x)
33{
34 return rintl(x);
35}
36#endif
Note: See TracBrowser for help on using the repository browser.