[GiNaC-devel] new function class

Richard B. Kreckel kreckel at ginac.de
Wed Feb 15 10:30:19 CET 2006


Hi!

Jens Vollinga wrote:

>ex log10_ginac::eval(int level) const
>{
>	if (op(0).is_equal(0)) {
>		return 666;
>	} else {
>		return this->hold();
>	}
>}
>
>template<typename T1> const GiNaC::log10_ginac log10(const T1& x) { return log10_ginac(x); }
>const GiNaC::log10_ginac log10(double x) { return log10_ginac(x); }
>const GiNaC::log10_ginac log10(float x) { return log10_ginac(x); }
>  
>

Oh, I so much prefer return-value error signaling over throwing up^W 
exceptions!

The only thing that confuses me are the specializations introduced for 
built-in floating point types.  The real conflicts are when the function 
argument is a built-in integral type, as then there is a template 
function in namespace std conflicting with the template function up 
there.  Maybe you really meant to specialize for built-in integral types 
because when using namespace GiNaC one would expect log10(2) to hold() 
but log10(2.0) to evalf()?  Or did I miss something?

Cheers
   -richy.

-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>



More information about the GiNaC-devel mailing list