PatchworkOS
Loading...
Searching...
No Matches
sin.c
Go to the documentation of this file.
1
#include <
errno.h
>
2
#include <math.h>
3
#include <
stdbool.h
>
4
5
// https://cppreference.com/w/c/numeric/math/sin.html
6
double
sin
(
double
x
)
7
{
8
if
(
x
== 0.0 ||
x
== -0.0)
9
{
10
return
0.0;
11
}
12
13
if
(
isinf
(
x
))
14
{
15
errno
=
EDOM
;
16
return
NAN
;
17
}
18
19
if
(
isnan
(
x
))
20
{
21
return
NAN
;
22
}
23
24
double
result;
25
asm
volatile
(
"fsin"
:
"=t"
(result) :
"0"
(
x
));
26
return
result;
27
}
errno.h
EDOM
#define EDOM
Math argument out of domain of func.
Definition
errno.h:197
errno
#define errno
Error number variable.
Definition
errno.h:27
isinf
#define isinf(x)
Definition
math.h:37
isnan
#define isnan(x)
Definition
math.h:39
NAN
#define NAN
Definition
math.h:20
x
int64_t x
Definition
main.c:152
sin
double sin(double x)
Definition
sin.c:6
stdbool.h
src
libstd
user
functions
math
sin.c
Generated by
1.9.8