Debian Codegraph @

tools/include/nolibc/math.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
2 /*
3 * math definitions for NOLIBC
4 * Copyright (C) 2025 Thomas Weißschuh <[email protected]>
5 */
6
7 /* make sure to include all global symbols */
8 #include "nolibc.h"
9
10 #ifndef _NOLIBC_SYS_MATH_H
11 #define _NOLIBC_SYS_MATH_H
12
13 static __inline__
14 double fabs(double x)
15 {
16 return x >= 0 ? x : -x;
17 }
18
19 static __inline__
20 float fabsf(float x)
21 {
22 return x >= 0 ? x : -x;
23 }
24
25 static __inline__
26 long double fabsl(long double x)
27 {
28 return x >= 0 ? x : -x;
29 }
30
31 #endif /* _NOLIBC_SYS_MATH_H */