8 class Log10Prim
: public xtended
13 Log10Prim() : xtended("logten") {}
15 virtual unsigned int arity () { return 1; }
17 virtual bool needCache () { return true; }
19 virtual Type
infereSigType (const vector
<Type
>& args
)
21 assert (args
.size() == arity());
22 interval i
= args
[0]->getInterval();
23 if (i
.valid
&& (i
.lo
> 0)) {
24 return castInterval(floatCast(args
[0]), interval(log10(i
.lo
), log10(i
.hi
)));
26 return floatCast(args
[0]);
30 virtual void sigVisit (Tree sig
, sigvisitor
* visitor
) {}
32 virtual int infereSigOrder (const vector
<int>& args
) {
33 assert (args
.size() == arity());
38 virtual Tree
computeSigOutput (const vector
<Tree
>& args
) {
40 assert (args
.size() == arity());
41 if (isNum(args
[0],n
)) {
42 return tree(log10(double(n
)));
44 return tree(symbol(), args
[0]);
48 virtual string
generateCode (Klass
* klass
, const vector
<string
>& args
, const vector
<Type
>& types
)
50 assert (args
.size() == arity());
51 assert (types
.size() == arity());
53 return subst("log10$1($0)", args
[0], isuffix());
56 virtual string
generateLateq (Lateq
* lateq
, const vector
<string
>& args
, const vector
<Type
>& types
)
58 assert (args
.size() == arity());
59 assert (types
.size() == arity());
61 return subst("\\log_{10}\\left( $0 \\right)", args
[0]);
67 xtended
* gLog10Prim
= new Log10Prim();