xref: /linux/tools/include/nolibc/math.h (revision 015a99fa76650e7d6efa3e36f20c0f5b346fe9ce)
1 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
2 /*
3  * math definitions for NOLIBC
4  * Copyright (C) 2025 Thomas Weißschuh <thomas.weissschuh@linutronix.de>
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__
fabs(double x)14 double fabs(double x)
15 {
16 	return x >= 0 ? x : -x;
17 }
18 
19 static __inline__
fabsf(float x)20 float fabsf(float x)
21 {
22 	return x >= 0 ? x : -x;
23 }
24 
25 static __inline__
fabsl(long double x)26 long double fabsl(long double x)
27 {
28 	return x >= 0 ? x : -x;
29 }
30 
31 #endif /* _NOLIBC_SYS_MATH_H */
32