RetroArch
math.h
Go to the documentation of this file.
1 /* RetroArch - A frontend for libretro.
2  * Copyright (C) 2010-2018 - Francisco Javier Trujillo Mata - fjtrujy
3  *
4  * RetroArch is free software: you can redistribute it and/or modify it under the terms
5  * of the GNU General Public License as published by the Free Software Found-
6  * ation, either version 3 of the License, or (at your option) any later version.
7  *
8  * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10  * PURPOSE. See the GNU General Public License for more details.
11  * * You should have received a copy of the GNU General Public License along with RetroArch.
12  * If not, see <http://www.gnu.org/licenses/>.
13  */
14 
15 #ifndef MATH_H
16 #define MATH_H
17 
18 #include <floatlib.h>
19 #define roundf(in) (in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f))
20 
21 #define cos(x) ((double)cosf((float)x))
22 #define pow(x, y) ((double)powf((float)x, (float)y))
23 #define sin(x) ((double)sinf((float)x))
24 #define ceil(x) ((double)ceilf((float)x))
25 #define floor(x) ((double)floorf((float)x))
26 #define sqrt(x) ((double)sqrtf((float)x))
27 #define fabs(x) ((double)fabsf((float)(x)))
28 
29 #define fmaxf(a, b) (((a) > (b)) ? (a) : (b))
30 #define fminf(a, b) (((a) < (b)) ? (a) : (b))
31 
32 #define exp(a) ((double)expf((float)a))
33 #define log(a) ((double)logf((float)a))
34 
35 #endif //MATH_H