PatchworkOS
19e446b
A non-POSIX operating system.
Theme:
Default
Round
Robot
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
#include <
sys/defs.h
>
5
6
// https://cppreference.com/w/c/numeric/math/sin.html
7
double
sin
(
double
x
)
8
{
9
if
(
x
== 0.0 ||
x
== -0.0)
10
{
11
return
0.0;
12
}
13
14
if
(
isinf
(
x
))
15
{
16
errno
=
EDOM
;
17
return
NAN
;
18
}
19
20
if
(
isnan
(
x
))
21
{
22
return
NAN
;
23
}
24
25
double
result;
26
ASM
(
"fsin"
:
"=t"
(result) :
"0"
(
x
));
27
return
result;
28
}
x
int64_t x
Definition
main.c:152
defs.h
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
ASM
#define ASM(...)
Inline assembly macro.
Definition
defs.h:160
isinf
#define isinf(x)
Definition
math.h:37
isnan
#define isnan(x)
Definition
math.h:39
NAN
#define NAN
Definition
math.h:20
sin
double sin(double x)
Definition
sin.c:7
stdbool.h
src
libstd
user
functions
math
sin.c
Generated on Sat Jan 24 2026 10:59:25 for PatchworkOS by
1.9.8