Python script for plotting data using Gnuplot
[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 #elif REAL == REAL_DOUBLE
26         typedef double Real;
27 #elif REAL == REAL_LONG_DOUBLE
28         typedef long double Real;
29 #elif REAL == REAL_SINGLE_FAST2SUM
30         typedef RealF2S<float> Real;
31         inline float Float(Real r) {return r.m_value;}
32                 
33 #else
34         #error "Type of Real unspecified."
35 #endif //REAL
36
37         // Allow us to call Float on the primative types
38         // Useful so I can template some things that could be either (a more complicated) Real or a primitive type
39         // Mostly in the testers.
40         inline float Float(float f) {return f;}
41         inline double Float(double f) {return f;}
42         inline double Float(long double f) {return double(f);}
43 }
44
45 #endif //_REAL_H

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