03007b438c6e301dd6acc145e00b196f1b1ec1be
7 class AcosPrim
: public xtended
12 AcosPrim() : xtended("acos") {}
14 virtual unsigned int arity () { return 1; }
16 virtual bool needCache () { return true; }
18 virtual Type
infereSigType (const vector
<Type
>& args
)
20 assert (args
.size() == 1);
21 return floatCast(args
[0]);
24 virtual void sigVisit (Tree sig
, sigvisitor
* visitor
) {}
26 virtual int infereSigOrder (const vector
<int>& args
) {
31 virtual Tree
computeSigOutput (const vector
<Tree
>& args
) {
33 if (isNum(args
[0],n
)) {
34 return tree(acos(double(n
)));
36 return tree(symbol(), args
[0]);
40 virtual string
generateCode (Klass
* klass
, const vector
<string
>& args
, const vector
<Type
>& types
)
42 assert (args
.size() == arity());
43 assert (types
.size() == arity());
45 return subst("acos$1($0)", args
[0], isuffix());
48 virtual string
generateLateq (Lateq
* lateq
, const vector
<string
>& args
, const vector
<Type
>& types
)
50 assert (args
.size() == arity());
51 assert (types
.size() == arity());
53 return subst("\\arccos\\left($0\\right)", args
[0]);
58 xtended
* gAcosPrim
= new AcosPrim();