FloatSpecs.h

Go to the documentation of this file.
00001 #ifndef FLOATSPECS_H
00002 #define FLOATSPECS_H
00003 
00028 #include <float.h>
00029 
00035 template < class Float >
00036 class FloatSpecs {
00037 public:
00038     Float ETA;      
00040     Float BASE;     
00041     Float INFINY;   
00042     Float SMALNO;   
00043     Float ARE;      
00044     Float MRE;      
00045     Float LOG_BASE; 
00047 public:
00049     FloatSpecs() {
00050         initConstants();
00051     }
00052 
00053 private:
00054 
00056     void initConstants() {
00057         getFPSpecs(ETA, INFINY, SMALNO, BASE);
00058         ARE = ETA;
00059         MRE = 2 * sqrt(Float(2.0)) * ETA;
00060         LOG_BASE = log(BASE);
00061     }
00062 
00064     static inline void getFPSpecs(float & eta, float & infiny, float & smalno, float & base) {
00065         base = FLT_RADIX;
00066         eta = FLT_EPSILON;
00067         infiny = FLT_MAX;
00068         smalno = FLT_MIN;
00069     }
00070 
00072     static inline void getFPSpecs(double & eta, double & infiny, double & smalno, double & base) {
00073         base = DBL_RADIX;
00074         eta = DBL_EPSILON;
00075         infiny = DBL_MAX;
00076         smalno = DBL_MIN;
00077     }
00078 
00080     static inline void getFPSpecs(long double & eta, long double & infiny, long double & smalno, long double & base) {
00081         base = LDBL_RADIX;
00082         eta = LDBL_EPSILON;
00083         infiny = LDBL_MAX;
00084         smalno = LDBL_MIN;
00085     }
00086 };
00087 
00088 #endif //FLOATSPECS_H

Generated on Mon Aug 21 21:00:37 2006 for The Polynomials Templates Library by  doxygen 1.4.5