00001 #ifndef FPARCH_TMPL_HEADER
00002 #define FPARCH_TMPL_HEADER
00003
00004
00005
00018
00019
00020 #include <stdlib.h>
00021 #include <sys/utsname.h>
00022
00023
00024
00025 namespace RazorBack {
00026
00037 template <class REAL>
00038 class Fparch_
00039 {
00040 private:
00041
00042 static const REAL ZERO, ONE, TWO;
00043
00044 struct utsname Utsname;
00045
00046 int Radix, Digits, Rnd, Negep, Machep, Nguard, Expdigits, Minexp, Maxexp;
00047 REAL Epsneg, Eps, Smallest, Largest;
00048
00049 public:
00050
00052 Fparch_();
00053
00055 const struct utsname* system_descr() const { return &Utsname; }
00056
00058 int radix() const { return Radix; }
00059
00061 int mantissa_digits() const { return Digits; }
00062
00064 int exponent_digits() const { return Expdigits; }
00065
00067 int min_exp() const { return Minexp; }
00068
00070 REAL smallest() const { return Smallest; }
00071
00073 int max_exp() const { return Maxexp; }
00074
00076 REAL largest() const { return Largest; }
00077
00079 int fpadd_round() const { return Rnd; }
00080
00082 bool round_ieee754() const { return (Rnd==2 || Rnd==5); }
00083
00085 bool round_non_ieee() const { return (Rnd==1 || Rnd==4); }
00086
00088 bool fp_truncate() const { return (Rnd==0 || Rnd==3); }
00089
00091 bool graceful_underflow() const { return (Rnd>=3); }
00092
00097 int negep() const { return Negep; }
00098
00100 REAL epsneg() const { return Epsneg; }
00101
00106 int machep() const { return Machep; }
00107
00109 REAL eps() const { return Eps; }
00110
00112 int nguard() const { return Nguard; }
00113
00114 protected:
00115
00116 static REAL absolute(REAL x) { return (x>=ZERO? x: -x); }
00117 };
00118
00119
00120 }
00121
00122 #ifdef INCLUDE_TMPL_DEFS
00123 #include "Fparch.cc"
00124 #endif
00125
00126
00127
00128 #endif // FPARCH_TMPL_HEADER