PatchworkOS
Loading...
Searching...
No Matches
floor.c
Go to the documentation of this file.
1
#include <math.h>
2
#include <
stdint.h
>
3
4
double
floor
(
double
x
)
5
{
6
if
(
isinf
(
x
) ||
x
== 0.0 ||
x
== -0.0)
7
{
8
return
x
;
9
}
10
11
if
(
isnan
(
x
))
12
{
13
return
NAN
;
14
}
15
16
if
(
fabs
(
x
) >=
INT64_MAX
)
17
{
18
return
x
;
19
}
20
21
int64_t
intPart = (
int64_t
)
x
;
22
if
(
x
< 0.0 &&
x
!= (
double
)intPart)
23
{
24
intPart--;
25
}
26
27
return
(
double
)intPart;
28
}
floor
double floor(double x)
Definition
floor.c:4
isinf
#define isinf(x)
Definition
math.h:37
isnan
#define isnan(x)
Definition
math.h:39
NAN
#define NAN
Definition
math.h:20
fabs
double fabs(double x)
Definition
fabs.c:3
x
int64_t x
Definition
main.c:152
stdint.h
int64_t
__INT64_TYPE__ int64_t
Definition
stdint.h:16
INT64_MAX
#define INT64_MAX
Definition
stdint.h:73
src
libstd
user
functions
math
floor.c
Generated by
1.9.8