Inherits xtended.
Public Member Functions | |
SqrtPrim () | |
virtual unsigned int | arity () |
virtual bool | needCache () |
virtual Type | infereSigType (const vector< Type > &args) |
virtual void | sigVisit (Tree sig, sigvisitor *visitor) |
virtual int | infereSigOrder (const vector< int > &args) |
virtual Tree | computeSigOutput (const vector< Tree > &args) |
virtual string | generateCode (Klass *klass, const vector< string > &args, const vector< Type > &types) |
virtual string | generateLateq (Lateq *lateq, const vector< string > &args, const vector< Type > &types) |
Definition at line 8 of file sqrtprim.cpp.
SqrtPrim::SqrtPrim | ( | ) | [inline] |
Definition at line 13 of file sqrtprim.cpp.
00013 : xtended("sqrt") {}
virtual unsigned int SqrtPrim::arity | ( | ) | [inline, virtual] |
Implements xtended.
Definition at line 15 of file sqrtprim.cpp.
Referenced by generateCode(), and generateLateq().
Implements xtended.
Definition at line 38 of file sqrtprim.cpp.
References isNum(), xtended::symbol(), and tree().
00038 { 00039 // verifier les simplifications 00040 num n; 00041 if (isNum(args[0],n)) { 00042 return tree(sqrt(double(n))); 00043 } else { 00044 return tree(symbol(), args[0]); 00045 } 00046 }
virtual string SqrtPrim::generateCode | ( | Klass * | klass, | |
const vector< string > & | args, | |||
const vector< Type > & | types | |||
) | [inline, virtual] |
Implements xtended.
Definition at line 48 of file sqrtprim.cpp.
References arity(), isuffix(), and subst().
00049 { 00050 assert (args.size() == arity()); 00051 assert (types.size() == arity()); 00052 00053 return subst("sqrt$1($0)", args[0], isuffix()); 00054 }
virtual int SqrtPrim::infereSigOrder | ( | const vector< int > & | args | ) | [inline, virtual] |
Implements xtended.
Definition at line 33 of file sqrtprim.cpp.
Implements xtended.
Definition at line 19 of file sqrtprim.cpp.
References castInterval(), floatCast(), interval::hi, interval::lo, and interval::valid.
00020 { 00021 assert (args.size() == 1); 00022 Type t = args[0]; 00023 interval i = t->getInterval(); 00024 if (i.valid && i.lo >=0) { 00025 return castInterval(floatCast(t), interval(sqrt(i.lo), sqrt(i.hi))); 00026 } else { 00027 return castInterval(floatCast(t), interval()); 00028 } 00029 }
virtual bool SqrtPrim::needCache | ( | ) | [inline, virtual] |
virtual void SqrtPrim::sigVisit | ( | Tree | sig, | |
sigvisitor * | visitor | |||
) | [inline, virtual] |
Definition at line 31 of file sqrtprim.cpp.