Skip to content
Snippets Groups Projects
Commit 722b5531 authored by Peter Bastian's avatar Peter Bastian
Browse files

some conversion operators and sqrt in namespace std for the mpf_class wrapper

[[Imported from SVN: r5945]]
parent 601b0a3b
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,23 @@ namespace Dune
return *this;
}
*/
// type conversion operators
operator double () const
{
return this->get_d();
}
operator float () const
{
return this->get_d();
}
operator mpf_class () const
{
return static_cast<const mpf_class&>(*this);
}
};
......@@ -90,6 +107,16 @@ namespace Dune
}
namespace std
{
template< unsigned int precision >
inline Dune::GMPField< precision >
sqrt ( const Dune::GMPField< precision > &a )
{
return Dune::GMPField< precision >(sqrt(static_cast<const mpf_class&>(a)));
}
}
#endif // HAVE_GMP
#endif // #ifndef DUNE_MULTIPRECISION_HH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment