<html lang="en"> <head> <title>TIC54X-Builtins - Using as</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="Using as"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="TIC54X_002dDependent.html#TIC54X_002dDependent" title="TIC54X-Dependent"> <link rel="prev" href="TIC54X_002dLocals.html#TIC54X_002dLocals" title="TIC54X-Locals"> <link rel="next" href="TIC54X_002dExt.html#TIC54X_002dExt" title="TIC54X-Ext"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This file documents the GNU Assembler "as". Copyright (C) 1991-2015 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. --> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="TIC54X-Builtins"></a> <a name="TIC54X_002dBuiltins"></a> <p> Next: <a rel="next" accesskey="n" href="TIC54X_002dExt.html#TIC54X_002dExt">TIC54X-Ext</a>, Previous: <a rel="previous" accesskey="p" href="TIC54X_002dLocals.html#TIC54X_002dLocals">TIC54X-Locals</a>, Up: <a rel="up" accesskey="u" href="TIC54X_002dDependent.html#TIC54X_002dDependent">TIC54X-Dependent</a> <hr> </div> <h4 class="subsection">9.43.7 Math Builtins</h4> <p><a name="index-math-builtins_002c-TIC54X-2058"></a><a name="index-TIC54X-builtin-math-functions-2059"></a><a name="index-builtin-math-functions_002c-TIC54X-2060"></a> The following built-in functions may be used to generate a floating-point value. All return a floating-point value except ‘<samp><span class="samp">$cvi</span></samp>’, ‘<samp><span class="samp">$int</span></samp>’, and ‘<samp><span class="samp">$sgn</span></samp>’, which return an integer value. <a name="index-g_t_0040code_007b_0024acos_007d-math-builtin_002c-TIC54X-2061"></a> <dl><dt><code>$acos(</code><var>expr</var><code>)</code><dd>Returns the floating point arccosine of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024asin_007d-math-builtin_002c-TIC54X-2062"></a><br><dt><code>$asin(</code><var>expr</var><code>)</code><dd>Returns the floating point arcsine of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024atan_007d-math-builtin_002c-TIC54X-2063"></a><br><dt><code>$atan(</code><var>expr</var><code>)</code><dd>Returns the floating point arctangent of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024atan2_007d-math-builtin_002c-TIC54X-2064"></a><br><dt><code>$atan2(</code><var>expr1</var><code>,</code><var>expr2</var><code>)</code><dd>Returns the floating point arctangent of <var>expr1</var> / <var>expr2</var>. <p><a name="index-g_t_0040code_007b_0024ceil_007d-math-builtin_002c-TIC54X-2065"></a><br><dt><code>$ceil(</code><var>expr</var><code>)</code><dd>Returns the smallest integer not less than <var>expr</var> as floating point. <p><a name="index-g_t_0040code_007b_0024cosh_007d-math-builtin_002c-TIC54X-2066"></a><br><dt><code>$cosh(</code><var>expr</var><code>)</code><dd>Returns the floating point hyperbolic cosine of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024cos_007d-math-builtin_002c-TIC54X-2067"></a><br><dt><code>$cos(</code><var>expr</var><code>)</code><dd>Returns the floating point cosine of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024cvf_007d-math-builtin_002c-TIC54X-2068"></a><br><dt><code>$cvf(</code><var>expr</var><code>)</code><dd>Returns the integer value <var>expr</var> converted to floating-point. <p><a name="index-g_t_0040code_007b_0024cvi_007d-math-builtin_002c-TIC54X-2069"></a><br><dt><code>$cvi(</code><var>expr</var><code>)</code><dd>Returns the floating point value <var>expr</var> converted to integer. <p><a name="index-g_t_0040code_007b_0024exp_007d-math-builtin_002c-TIC54X-2070"></a><br><dt><code>$exp(</code><var>expr</var><code>)</code><dd>Returns the floating point value e ^ <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024fabs_007d-math-builtin_002c-TIC54X-2071"></a><br><dt><code>$fabs(</code><var>expr</var><code>)</code><dd>Returns the floating point absolute value of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024floor_007d-math-builtin_002c-TIC54X-2072"></a><br><dt><code>$floor(</code><var>expr</var><code>)</code><dd>Returns the largest integer that is not greater than <var>expr</var> as floating point. <p><a name="index-g_t_0040code_007b_0024fmod_007d-math-builtin_002c-TIC54X-2073"></a><br><dt><code>$fmod(</code><var>expr1</var><code>,</code><var>expr2</var><code>)</code><dd>Returns the floating point remainder of <var>expr1</var> / <var>expr2</var>. <p><a name="index-g_t_0040code_007b_0024int_007d-math-builtin_002c-TIC54X-2074"></a><br><dt><code>$int(</code><var>expr</var><code>)</code><dd>Returns 1 if <var>expr</var> evaluates to an integer, zero otherwise. <p><a name="index-g_t_0040code_007b_0024ldexp_007d-math-builtin_002c-TIC54X-2075"></a><br><dt><code>$ldexp(</code><var>expr1</var><code>,</code><var>expr2</var><code>)</code><dd>Returns the floating point value <var>expr1</var> * 2 ^ <var>expr2</var>. <p><a name="index-g_t_0040code_007b_0024log10_007d-math-builtin_002c-TIC54X-2076"></a><br><dt><code>$log10(</code><var>expr</var><code>)</code><dd>Returns the base 10 logarithm of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024log_007d-math-builtin_002c-TIC54X-2077"></a><br><dt><code>$log(</code><var>expr</var><code>)</code><dd>Returns the natural logarithm of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024max_007d-math-builtin_002c-TIC54X-2078"></a><br><dt><code>$max(</code><var>expr1</var><code>,</code><var>expr2</var><code>)</code><dd>Returns the floating point maximum of <var>expr1</var> and <var>expr2</var>. <p><a name="index-g_t_0040code_007b_0024min_007d-math-builtin_002c-TIC54X-2079"></a><br><dt><code>$min(</code><var>expr1</var><code>,</code><var>expr2</var><code>)</code><dd>Returns the floating point minimum of <var>expr1</var> and <var>expr2</var>. <p><a name="index-g_t_0040code_007b_0024pow_007d-math-builtin_002c-TIC54X-2080"></a><br><dt><code>$pow(</code><var>expr1</var><code>,</code><var>expr2</var><code>)</code><dd>Returns the floating point value <var>expr1</var> ^ <var>expr2</var>. <p><a name="index-g_t_0040code_007b_0024round_007d-math-builtin_002c-TIC54X-2081"></a><br><dt><code>$round(</code><var>expr</var><code>)</code><dd>Returns the nearest integer to <var>expr</var> as a floating point number. <p><a name="index-g_t_0040code_007b_0024sgn_007d-math-builtin_002c-TIC54X-2082"></a><br><dt><code>$sgn(</code><var>expr</var><code>)</code><dd>Returns -1, 0, or 1 based on the sign of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024sin_007d-math-builtin_002c-TIC54X-2083"></a><br><dt><code>$sin(</code><var>expr</var><code>)</code><dd>Returns the floating point sine of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024sinh_007d-math-builtin_002c-TIC54X-2084"></a><br><dt><code>$sinh(</code><var>expr</var><code>)</code><dd>Returns the floating point hyperbolic sine of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024sqrt_007d-math-builtin_002c-TIC54X-2085"></a><br><dt><code>$sqrt(</code><var>expr</var><code>)</code><dd>Returns the floating point square root of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024tan_007d-math-builtin_002c-TIC54X-2086"></a><br><dt><code>$tan(</code><var>expr</var><code>)</code><dd>Returns the floating point tangent of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024tanh_007d-math-builtin_002c-TIC54X-2087"></a><br><dt><code>$tanh(</code><var>expr</var><code>)</code><dd>Returns the floating point hyperbolic tangent of <var>expr</var>. <p><a name="index-g_t_0040code_007b_0024trunc_007d-math-builtin_002c-TIC54X-2088"></a><br><dt><code>$trunc(</code><var>expr</var><code>)</code><dd>Returns the integer value of <var>expr</var> truncated towards zero as floating point. </dl> </body></html>