Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 43bdde4

Browse files
sjoelundOpenModelica-Hudson
authored andcommitted
Add the trigonometric functions to EmbeddedC
Belonging to [master]: - #2851
1 parent 17e1186 commit 43bdde4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Compiler/Template/CodegenEmbeddedC.tpl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,21 @@ template daeExpCallBuiltin(Exp exp)
483483
case CALL(path=IDENT(name="abs"),expLst={exp1}) then 'fabs(<%daeExp(exp1)%>)'
484484
case CALL(path=IDENT(name="min"),expLst={exp1,exp2},attr=CALL_ATTR(ty=T_REAL(__))) then 'fmin(<%daeExp(exp1)%>,<%daeExp(exp2)%>)'
485485
case CALL(path=IDENT(name="max"),expLst={exp1,exp2},attr=CALL_ATTR(ty=T_REAL(__))) then 'fmax(<%daeExp(exp1)%>,<%daeExp(exp2)%>)'
486+
case CALL(path=IDENT(name=name as "sin"),expLst={exp1})
487+
case CALL(path=IDENT(name=name as "cos"),expLst={exp1})
488+
case CALL(path=IDENT(name=name as "tan"),expLst={exp1})
489+
case CALL(path=IDENT(name=name as "asin"),expLst={exp1})
490+
case CALL(path=IDENT(name=name as "acos"),expLst={exp1})
491+
case CALL(path=IDENT(name=name as "atan"),expLst={exp1})
492+
case CALL(path=IDENT(name=name as "sinh"),expLst={exp1})
493+
case CALL(path=IDENT(name=name as "cosh"),expLst={exp1})
494+
case CALL(path=IDENT(name=name as "tanh"),expLst={exp1})
495+
case CALL(path=IDENT(name=name as "exp"),expLst={exp1})
496+
case CALL(path=IDENT(name=name as "log"),expLst={exp1})
497+
case CALL(path=IDENT(name=name as "log10"),expLst={exp1})
498+
then '<%name%>(<%daeExp(exp1)%>)'
499+
case CALL(path=IDENT(name=name as "atan2"),expLst={exp1,exp2})
500+
then '<%name%>(<%daeExp(exp1)%>,<%daeExp(exp2)%>)'
486501
/* TODO: Generate used builtin functions before SimCode */
487502
case CALL(path=IDENT(name="mod"),expLst=exp1::exp2::_) then 'om_mod(<%daeExp(exp1)%>,<%daeExp(exp2)%>)'
488503
/* TODO: pre needs to be handled in a special way */

0 commit comments

Comments
 (0)