b5615600dcc45e3b512c209beb3673d667abbad3
7 class CeilPrim
: public xtended
12 CeilPrim() : xtended("ceil") {}
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() == arity());
21 return floatCast(args
[0]);
24 virtual void sigVisit (Tree sig
, sigvisitor
* visitor
) {}
26 virtual int infereSigOrder (const vector
<int>& args
) {
27 assert (args
.size() == arity());
32 virtual Tree
computeSigOutput (const vector
<Tree
>& args
) {
34 assert (args
.size() == arity());
35 if (isNum(args
[0],n
)) {
36 return tree(ceil(double(n
)));
38 return tree(symbol(), args
[0]);
42 virtual string
generateCode (Klass
* klass
, const vector
<string
>& args
, const vector
<Type
>& types
)
44 assert (args
.size() == arity());
45 assert (types
.size() == arity());
47 return subst("ceil$1($0)", args
[0], isuffix());
50 virtual string
generateLateq (Lateq
* lateq
, const vector
<string
>& args
, const vector
<Type
>& types
)
52 assert (args
.size() == arity());
53 assert (types
.size() == arity());
55 return subst("\\left\\lceil $0 \\right\\rceil", args
[0]);
61 xtended
* gCeilPrim
= new CeilPrim();