grblHAL core  20260916
real.h
Go to the documentation of this file.
1 /*
2  real.h - wrappers for real type (float or double)
3 
4  Part of grblHAL
5 
6  Copyright (c) 2026 Terje Io
7 
8  grblHAL is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  grblHAL is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with grblHAL. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #pragma once
23 
24 #if REAL_IS_DOUBLE
25 
26 typedef double real_t;
27 
28 #define powr(a, b) pow(a, b)
29 #define sqrtr(a) sqrt(a)
30 #define fabsr(a) fabs(a)
31 #define sinr(a) sin(a)
32 #define asinr(a) asin(a)
33 #define cosr(a) cos(a)
34 #define acosr(a) acos(a)
35 #define tanr(a) tan(a)
36 #define atanr(a) atan(a)
37 #define atan2r(a, b) atan(a, b)
38 #define ceilr(a) ceil(a)
39 #define floorr(a) floor(a)
40 #define lroundr(a) lround(a)
41 #define truncr(a) trunc(a)
42 #define modfr(a, b) modf(a, b)
43 #define fmodr(a, b) fmod(a, b)
44 #define isnanr(a) isnan(a)
45 
46 #else
47 
48 typedef float real_t;
49 
50 #define powr(a, b) powf(a, b)
51 #define sqrtr(a) sqrtf(a)
52 #define fabsr(a) fabsf(a)
53 #define sinr(a) sinf(a)
54 #define asinr(a) asinf(a)
55 #define cosr(a) cosf(a)
56 #define acosr(a) acosf(a)
57 #define tanr(a) tanf(a)
58 #define atanr(a) atanf(a)
59 #define atan2r(a, b) atanf(a, b)
60 #define ceilr(a) ceilf(a)
61 #define floorr(a) floorf(a)
62 #define lroundr(a) lroundf(a)
63 #define truncr(a) truncf(a)
64 #define modfr(a, b) modff(a, b)
65 #define fmodr(a, b) fmodf(a, b)
66 #define isnanr(a) isnanf(a)
67 
68 #endif
float real_t
Definition: real.h:48