PandA-2024.02
documentation
tutorial_hpca_2023
03-optimizations
Exercise5
solution
module.c
Go to the documentation of this file.
1
#include <math.h>
2
3
#ifdef FP_SINGLE
4
#define FP_TYPE float
5
#define ACOS(a) acosf(a)
6
#else
7
#define FP_TYPE double
8
#define ACOS(a) acos(a)
9
#endif
10
11
#ifdef MULT_SQUARE
12
#define SQUARE(a) (a*a)
13
#else
14
#ifdef FP_SINGLE
15
#define SQUARE(a) powf(a,2)
16
#else
17
#define SQUARE(a) pow(a,2)
18
#endif
19
#endif
20
21
FP_TYPE
awesome_math
(
FP_TYPE
a,
FP_TYPE
b,
FP_TYPE
c)
22
{
23
return
ACOS
((
SQUARE
(a) +
SQUARE
(b) -
SQUARE
(c))/(2*a*b));
24
}
ACOS
#define ACOS(a)
Definition:
module.c:8
awesome_math
FP_TYPE awesome_math(FP_TYPE a, FP_TYPE b, FP_TYPE c)
Definition:
module.c:21
FP_TYPE
#define FP_TYPE
Definition:
module.c:7
SQUARE
#define SQUARE(a)
Definition:
module.c:17
Generated on Mon Feb 12 2024 13:02:48 for PandA-2024.02 by
1.8.13