Inherits xtended.
Public Member Functions | |
LogPrim () | |
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 7 of file logprim.cpp.
LogPrim::LogPrim | ( | ) | [inline] |
Definition at line 12 of file logprim.cpp.
00012 : xtended("log") {}
virtual unsigned int LogPrim::arity | ( | ) | [inline, virtual] |
Implements xtended.
Definition at line 14 of file logprim.cpp.
Referenced by computeSigOutput(), generateCode(), generateLateq(), infereSigOrder(), and infereSigType().
Implements xtended.
Definition at line 37 of file logprim.cpp.
References arity(), isNum(), xtended::symbol(), and tree().
00037 { 00038 num n; 00039 assert (args.size() == arity()); 00040 if (isNum(args[0],n)) { 00041 return tree(log(double(n))); 00042 } else { 00043 return tree(symbol(), args[0]); 00044 } 00045 }
virtual string LogPrim::generateCode | ( | Klass * | klass, | |
const vector< string > & | args, | |||
const vector< Type > & | types | |||
) | [inline, virtual] |
Implements xtended.
Definition at line 47 of file logprim.cpp.
References arity(), isuffix(), and subst().
00048 { 00049 assert (args.size() == arity()); 00050 assert (types.size() == arity()); 00051 00052 return subst("log$1($0)", args[0], isuffix()); 00053 }
virtual int LogPrim::infereSigOrder | ( | const vector< int > & | args | ) | [inline, virtual] |
Implements xtended.
Definition at line 31 of file logprim.cpp.
References arity().
00031 { 00032 assert (args.size() == arity()); 00033 return args[0]; 00034 }
Implements xtended.
Definition at line 18 of file logprim.cpp.
References arity(), castInterval(), and floatCast().
00019 { 00020 assert (args.size() == arity()); 00021 interval i = args[0]->getInterval(); 00022 if (i.valid & i.lo>0) { 00023 return castInterval(floatCast(args[0]), interval(log(i.lo), log(i.hi))); 00024 } else { 00025 return floatCast(args[0]); 00026 } 00027 }
virtual bool LogPrim::needCache | ( | ) | [inline, virtual] |
virtual void LogPrim::sigVisit | ( | Tree | sig, | |
sigvisitor * | visitor | |||
) | [inline, virtual] |
Definition at line 29 of file logprim.cpp.