Real that uses Fast2Sum for addition
[ipdf/code.git] / src / real.h
1 #ifndef _REAL_H
2 #define _REAL_H
3
4 #include "common.h"
5
6 #define REAL_SINGLE 0
7 #define REAL_DOUBLE 1
8 #define REAL_LONG_DOUBLE 2
9 #define REAL_SINGLE_FAST2SUM 3
10
11 #ifndef REAL
12         #error "REAL was not defined!"
13 #endif
14
15 #if REAL >= REAL_SINGLE_FAST2SUM
16         #include "real_fast2sum.h"
17 #endif //REAL
18
19 namespace IPDF
20 {       
21         extern const char * g_real_name[];
22
23 #if REAL == REAL_SINGLE
24         typedef float Real;
25         inline float Float(Real r) {return r;}
26 #elif REAL == REAL_DOUBLE
27         typedef double Real;
28         inline double Float(Real r) {return r;}
29 #elif REAL == REAL_LONG_DOUBLE
30         typedef long double Real;
31         inline long double Float(Real r) {return r;}
32 #elif REAL == REAL_SINGLE_FAST2SUM
33         typedef RealF2S<float> Real;
34         inline float Float(Real r) {return r.m_value;}
35                 
36 #else
37         #error "Type of Real unspecified."
38 #endif //REAL
39
40 }
41
42 #endif //_REAL_H

UCC git Repository :: git.ucc.asn.au