1 #ifndef DUNE_GMPFIELD_HH
2 #define DUNE_GMPFIELD_HH
17 template<
unsigned int precision >
21 typedef mpf_class Base;
29 GMPField (
const T &v )
42 operator double ()
const
47 operator float ()
const
52 operator mpf_class ()
const
54 return static_cast<const mpf_class&
>(*this);
60 template<
unsigned int precision >
61 inline GMPField< precision >
62 operator+ (
const GMPField< precision > &a,
const GMPField< precision > &b )
65 return ((
const F &)a + (
const F &)b);
68 template<
unsigned int precision >
69 inline GMPField< precision >
70 operator- (
const GMPField< precision > &a,
const GMPField< precision > &b )
73 return ((
const F &)a - (
const F &)b);
76 template<
unsigned int precision >
77 inline GMPField< precision >
78 operator- (
const GMPField< precision > &a )
81 return -((
const F &)a);
84 template<
unsigned int precision >
85 inline GMPField< precision >
86 operator* (
const GMPField< precision > &a,
const GMPField< precision > &b )
89 return ((
const F &)a * (
const F &)b);
92 template<
unsigned int precision >
93 inline GMPField< precision >
94 operator/ (
const GMPField< precision > &a,
const GMPField< precision > &b )
97 return ((
const F &)a / (
const F &)b);
102 template<
unsigned int precision >
103 inline std::ostream &
104 operator<< ( std::ostream &out, const GMPField< precision > &value )
106 return out << static_cast<const mpf_class&>(value);
114 template<
unsigned int precision >
115 inline Dune::GMPField< precision >
116 sqrt (
const Dune::GMPField< precision > &a )
118 return Dune::GMPField< precision >(sqrt(static_cast<const mpf_class&>(a)));
121 template<
unsigned int precision >
122 inline Dune::GMPField< precision >
123 abs (
const Dune::GMPField< precision > &a )
125 return Dune::GMPField< precision >( abs( static_cast< const mpf_class & >( a ) ) );
132 #endif // #ifndef DUNE_GMPFIELD_HH