<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>FAUST compiler: atan2prim.cpp Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.3 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <h1>atan2prim.cpp</h1><a href="atan2prim_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include "<a class="code" href="xtended_8hh.html">xtended.hh</a>"</span> <a name="l00002"></a>00002 <span class="preprocessor">#include "<a class="code" href="Text_8hh.html">Text.hh</a>"</span> <a name="l00003"></a>00003 <span class="preprocessor">#include <math.h></span> <a name="l00004"></a>00004 <a name="l00005"></a>00005 <span class="preprocessor">#include "<a class="code" href="floats_8hh.html">floats.hh</a>"</span> <a name="l00006"></a>00006 <a name="l00007"></a><a class="code" href="classAtan2Prim.html">00007</a> <span class="keyword">class </span><a class="code" href="classAtan2Prim.html">Atan2Prim</a> : <span class="keyword">public</span> <a class="code" href="classxtended.html">xtended</a> <a name="l00008"></a>00008 { <a name="l00009"></a>00009 <a name="l00010"></a>00010 <span class="keyword">public</span>: <a name="l00011"></a>00011 <a name="l00012"></a><a class="code" href="classAtan2Prim.html#a20f74f9d7200fe68f36e86ffad651920">00012</a> <a class="code" href="classAtan2Prim.html#a20f74f9d7200fe68f36e86ffad651920">Atan2Prim</a>() : <a class="code" href="classxtended.html">xtended</a>(<span class="stringliteral">"atan2"</span>) {} <a name="l00013"></a>00013 <a name="l00014"></a><a class="code" href="classAtan2Prim.html#a0ca2392bf6232f1efccc030f4157d1e6">00014</a> <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classAtan2Prim.html#a0ca2392bf6232f1efccc030f4157d1e6">arity</a> () { <span class="keywordflow">return</span> 2; } <a name="l00015"></a>00015 <a name="l00016"></a><a class="code" href="classAtan2Prim.html#a4fac1dddadd85842fb0f1edcb2f9bb03">00016</a> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classAtan2Prim.html#a4fac1dddadd85842fb0f1edcb2f9bb03">needCache</a> () { <span class="keywordflow">return</span> <span class="keyword">true</span>; } <a name="l00017"></a>00017 <a name="l00018"></a><a class="code" href="classAtan2Prim.html#a713f14eb68822348c1aa25639eb9ba06">00018</a> <span class="keyword">virtual</span> <a class="code" href="classP.html">Type</a> <a class="code" href="classAtan2Prim.html#a713f14eb68822348c1aa25639eb9ba06">infereSigType</a> (<span class="keyword">const</span> vector<Type>& args) <a name="l00019"></a>00019 { <a name="l00020"></a>00020 assert (args.size() == 2); <a name="l00021"></a>00021 <span class="keywordflow">return</span> <a class="code" href="sigtype_8hh.html#a77cfb136d0b19316d3f95c700d4262f8">floatCast</a>(args[0]|args[1]); <a name="l00022"></a>00022 } <a name="l00023"></a>00023 <a name="l00024"></a><a class="code" href="classAtan2Prim.html#add05d800a9a9f94a57cdb5b046c46db1">00024</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classAtan2Prim.html#add05d800a9a9f94a57cdb5b046c46db1">sigVisit</a> (<a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> sig, <a class="code" href="structsigvisitor.html">sigvisitor</a>* visitor) {} <a name="l00025"></a>00025 <a name="l00026"></a><a class="code" href="classAtan2Prim.html#a0a2df8eae7f77d9690216f7c7fd67237">00026</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classAtan2Prim.html#a0a2df8eae7f77d9690216f7c7fd67237">infereSigOrder</a> (<span class="keyword">const</span> vector<int>& args) { <a name="l00027"></a>00027 <span class="keywordflow">return</span> <a class="code" href="interval_8hh.html#a1c45761573e6cbc97cfacac78d905016">max</a>(args[0], args[1]); <a name="l00028"></a>00028 } <a name="l00029"></a>00029 <a name="l00030"></a>00030 <a name="l00031"></a><a class="code" href="classAtan2Prim.html#aa77d0dceead72d75de4dc09bbef31b24">00031</a> <span class="keyword">virtual</span> <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> <a class="code" href="classAtan2Prim.html#aa77d0dceead72d75de4dc09bbef31b24">computeSigOutput</a> (<span class="keyword">const</span> vector<Tree>& args) <a name="l00032"></a>00032 { <a name="l00033"></a>00033 assert (args.size() == 2); <a name="l00034"></a>00034 <a class="code" href="classnum.html">num</a> n,m; <a name="l00035"></a>00035 <span class="keywordflow">if</span> (<a class="code" href="signals_8hh.html#acd2773c99643a2dcc1c5409991c211e9">isNum</a>(args[0],n) && <a class="code" href="signals_8hh.html#acd2773c99643a2dcc1c5409991c211e9">isNum</a>(args[1],m)) { <a name="l00036"></a>00036 <span class="keywordflow">return</span> <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(atan2(<span class="keywordtype">double</span>(n), <span class="keywordtype">double</span>(m))); <a name="l00037"></a>00037 } <span class="keywordflow">else</span> { <a name="l00038"></a>00038 <span class="keywordflow">return</span> <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(<a class="code" href="classxtended.html#ae7e621bd8015110e7af77ab7c850f573">symbol</a>(), args[0], args[1]); <a name="l00039"></a>00039 } <a name="l00040"></a>00040 } <a name="l00041"></a>00041 <a name="l00042"></a><a class="code" href="classAtan2Prim.html#a32ecb1b77a8811710ce333a1bda52d1e">00042</a> <span class="keyword">virtual</span> <span class="keywordtype">string</span> <a class="code" href="classAtan2Prim.html#a32ecb1b77a8811710ce333a1bda52d1e">generateCode</a> (<a class="code" href="classKlass.html">Klass</a>* klass, <span class="keyword">const</span> vector<string>& args, <span class="keyword">const</span> vector<Type>& types) <a name="l00043"></a>00043 { <a name="l00044"></a>00044 assert (args.size() == <a class="code" href="classAtan2Prim.html#a0ca2392bf6232f1efccc030f4157d1e6">arity</a>()); <a name="l00045"></a>00045 assert (types.size() == <a class="code" href="classAtan2Prim.html#a0ca2392bf6232f1efccc030f4157d1e6">arity</a>()); <a name="l00046"></a>00046 <a name="l00047"></a>00047 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"atan2$2($0,$1)"</span>, args[0], args[1], <a class="code" href="floats_8cpp.html#a4091ebb0e4eff17b3ff908531df9fb92" title="suffix for math functions">isuffix</a>()); <a name="l00048"></a>00048 } <a name="l00049"></a>00049 <a name="l00050"></a><a class="code" href="classAtan2Prim.html#a197b0f3d97bfbcb9498367560c699773">00050</a> <span class="keyword">virtual</span> <span class="keywordtype">string</span> <a class="code" href="classAtan2Prim.html#a197b0f3d97bfbcb9498367560c699773">generateLateq</a> (<a class="code" href="classLateq.html">Lateq</a>* lateq, <span class="keyword">const</span> vector<string>& args, <span class="keyword">const</span> vector<Type>& types) <a name="l00051"></a>00051 { <a name="l00052"></a>00052 assert (args.size() == <a class="code" href="classAtan2Prim.html#a0ca2392bf6232f1efccc030f4157d1e6">arity</a>()); <a name="l00053"></a>00053 assert (types.size() == <a class="code" href="classAtan2Prim.html#a0ca2392bf6232f1efccc030f4157d1e6">arity</a>()); <a name="l00054"></a>00054 <a name="l00055"></a>00055 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"\\arctan\\frac{$0}{$1}"</span>, args[0], args[1]); <a name="l00056"></a>00056 } <a name="l00057"></a>00057 <a name="l00058"></a>00058 }; <a name="l00059"></a>00059 <a name="l00060"></a>00060 <a name="l00061"></a><a class="code" href="xtended_8hh.html#ac022031e34e25223d9809e1da7e051f2">00061</a> <a class="code" href="classxtended.html">xtended</a>* <a class="code" href="atan2prim_8cpp.html#ac022031e34e25223d9809e1da7e051f2">gAtan2Prim</a> = <span class="keyword">new</span> <a class="code" href="classAtan2Prim.html">Atan2Prim</a>(); <a name="l00062"></a>00062 <a name="l00063"></a>00063 </pre></div></div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Wed Apr 28 23:59:58 2010 for FAUST compiler by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>