docs/reference/language_extensions.xml
author ali <ali@juiblex.co.uk>
Wed Oct 10 22:58:21 2012 +0100 (2012-10-10)
changeset 0 bc8c9a11cbfc
permissions -rw-r--r--
Initial version
     1 <?xml version="1.0"?>
     2 <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
     3                "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
     4 [
     5 ]>
     6 <chapter id="language-extensions">
     7   <title>Language Extensions</title>
     8 
     9   <para>
    10     These language extensions are provided in the following namespace URI:
    11     <screen>
    12 http://www.juiblex.co.uk/ns/libxexpr
    13     </screen>
    14     People using this namespace are encouraged to use the libxexpr namespace
    15     prefix.
    16   </para>
    17 
    18   <sect1 id="libxexpr-pi">
    19     <title>Function &lt;pi&gt;</title>
    20 
    21     <simplesect>
    22       <title>Synopsis</title>
    23 	<para>
    24 	  &lt;pi&gt; returns the value of π.
    25 	</para>
    26     </simplesect>
    27 
    28     <simplesect>
    29       <title>Arguments</title>
    30 	<para>
    31 	  &lt;pi&gt; takes no arguments.
    32 	</para>
    33     </simplesect>
    34 
    35     <simplesect>
    36       <title>Return Values</title>
    37 	<para>
    38 	  &lt;pi&gt; returns the value of π.
    39 	</para>
    40     </simplesect>
    41 
    42     <example>
    43       <programlisting>
    44 &lt;libxexpr:pi/&gt; ≅ &lt;float&gt;3.14&lt;/float&gt;<!--
    45    --></programlisting>
    46     </example>
    47   </sect1>
    48 
    49   <sect1 id="libxexpr-sin">
    50     <title>Function &lt;sin&gt;</title>
    51 
    52     <simplesect>
    53       <title>Synopsis</title>
    54 	<para>
    55 	  &lt;sin&gt; computes the sine function.
    56 	</para>
    57     </simplesect>
    58 
    59     <simplesect>
    60       <title>Arguments</title>
    61 	<para>
    62 	  &lt;sin&gt; takes one argument: x. If no argument is given, an error
    63 	  occurs.
    64 	</para>
    65     </simplesect>
    66 
    67     <simplesect>
    68       <title>Return Values</title>
    69 	<para>
    70 	  &lt;sin&gt; returns the sine of its argument, given in radians.
    71 	  If the argument does not evaluate to a finite number,
    72 	  &lt;sin&gt; returns an indeterminate result.
    73 	</para>
    74     </simplesect>
    75 
    76     <example>
    77       <programlisting>
    78 &lt;libxexpr:sin&gt;
    79   &lt;divide&gt;
    80     &lt;libxexpr:pi/&gt;
    81     2
    82   &lt;/divide&gt;
    83 &lt;/libxexpr:sin&gt; --> &lt;float&gt;1&lt;/float&gt;<!--
    84    --></programlisting>
    85     </example>
    86   </sect1>
    87 
    88   <sect1 id="libxexpr-atan">
    89     <title>Function &lt;atan&gt;</title>
    90 
    91     <simplesect>
    92       <title>Synopsis</title>
    93 	<para>
    94 	  &lt;atan&gt; computes the arc tangent function.
    95 	</para>
    96     </simplesect>
    97 
    98     <simplesect>
    99       <title>Arguments</title>
   100 	<para>
   101 	  &lt;atan&gt; takes two arguments: x and y. The y argument defaults to
   102 	  1. If the x argument is missing, an error occurs.
   103 	</para>
   104     </simplesect>
   105 
   106     <simplesect>
   107       <title>Return Values</title>
   108 	<para>
   109 	  &lt;atan&gt; returns the principal value of the arc tangent of its
   110 	  argument(s) in radians. If either argument is indeterminate,
   111 	  the result is also indeterminate.
   112 	</para>
   113 	
   114 	<para>
   115 	  If two arguments are given, &lt;atan&gt; returns the arc tangent of
   116 	  y/x, using the signs of the two arguments to determine the quadrant
   117 	  of the result which will be in the range [-π, π]. If both arguments
   118 	  are 0, the result will also be 0.
   119 	</para>
   120 
   121 	<para>
   122 	  If only one argument is given, &lt;atan&gt; returns the arc tangent of
   123 	  its argument. The result will be in the range [-π/2, π/2].
   124 	</para>
   125     </simplesect>
   126 
   127     <example>
   128       <programlisting>
   129 &lt;libxexpr:atan&gt;1 0&lt;/libxexpr:atan&gt; --> &lt;float&gt;0&lt;/float&gt;<!--
   130    --></programlisting>
   131     </example>
   132   </sect1>
   133 
   134   <sect1 id="libxexpr-exp">
   135     <title>Function &lt;exp&gt;</title>
   136 
   137     <simplesect>
   138       <title>Synopsis</title>
   139 	<para>
   140 	  &lt;exp&gt; computes the base-e exponential function.
   141 	</para>
   142     </simplesect>
   143 
   144     <simplesect>
   145       <title>Arguments</title>
   146 	<para>
   147 	  &lt;exp&gt; takes zero or one argument: x.
   148 	</para>
   149     </simplesect>
   150 
   151     <simplesect>
   152       <title>Return Values</title>
   153 	<para>
   154 	  &lt;exp&gt; returns the value of e (the base of natural logarithms)
   155 	  raised to the power of its argument (or just e if no argument is
   156 	  supplied). If the argument does not evaluate to a finite number,
   157 	  &lt;exp&gt; returns an indeterminate result.
   158 	</para>
   159     </simplesect>
   160 
   161     <example>
   162       <programlisting>
   163 &lt;libxexpr:exp&gt;2&lt;/libxexpr:exp&gt; ≅ &lt;float&gt;7.389&lt;/float&gt;<!--
   164    --></programlisting>
   165     </example>
   166   </sect1>
   167 
   168   <sect1 id="libxexpr-log">
   169     <title>Function &lt;log&gt;</title>
   170 
   171     <simplesect>
   172       <title>Synopsis</title>
   173 	<para>
   174 	  &lt;log&gt; computes the natural logarithmic function.
   175 	</para>
   176     </simplesect>
   177 
   178     <simplesect>
   179       <title>Arguments</title>
   180 	<para>
   181 	  &lt;log&gt; takes one argument: x. If no argument is given, an error
   182 	  occurs.
   183 	</para>
   184     </simplesect>
   185 
   186     <simplesect>
   187       <title>Return Values</title>
   188 	<para>
   189 	  &lt;log&gt; returns the natural logarithm of its argument.
   190 	  If the argument does not evaluate to a positive finite number,
   191 	  &lt;log&gt; returns an indeterminate result.
   192 	</para>
   193     </simplesect>
   194 
   195     <example>
   196       <programlisting>
   197 &lt;libxexpr:log&gt;
   198   &lt;libxexpr:exp&gt;2&lt;/libxexpr:exp&gt;
   199 &lt;/libxexpr:log&gt; --> &lt;float&gt;2&lt;/float&gt;<!--
   200    --></programlisting>
   201     </example>
   202   </sect1>
   203 
   204   <sect1 id="libxexpr-pow">
   205     <title>Function &lt;pow&gt;</title>
   206 
   207     <simplesect>
   208       <title>Synopsis</title>
   209 	<para>
   210 	  &lt;pow&gt; computes the value of its first argument raised to the
   211 	  power of its second argument.
   212 	</para>
   213     </simplesect>
   214 
   215     <simplesect>
   216       <title>Arguments</title>
   217 	<para>
   218 	  &lt;pow&gt; takes two arguments: x and y. If fewer arguments are
   219 	  given, an error occurs.
   220 	</para>
   221     </simplesect>
   222 
   223     <simplesect>
   224       <title>Return Values</title>
   225 	<para>
   226 	  &lt;pow&gt; returns the value of x (its first argument) raised to the
   227 	  power of y (its second argument).
   228 	</para>
   229 
   230 	<para>
   231 	  If x is a finite value less than 0, and y is a finite non-integer,
   232 	  &lt;pow&gt; returns an indeterminate result. 
   233 	</para>
   234 
   235 	<para>
   236 	  If the result overflows, &lt;pow&gt; returns an indeterminate result. 
   237 	</para>
   238 
   239 	<para>
   240 	  If result underflows, and is not representable, 0 is returned.
   241 	</para>
   242 
   243 	<para>
   244 	  Except as specified below, if either argument is indeterminate,
   245 	  the result is also indeterminate.
   246 	</para>
   247 
   248 	<para>
   249 	  If x is 1, the result is 1 (even if y is indeterminate).
   250 	</para>
   251 
   252 	<para>
   253 	  If y is 0, the result is 1 (even if x is indeterminate).
   254 	</para>
   255 
   256 	<para>
   257 	  If x is 0, and y is an odd integer greater than 0, the result is 0.
   258 	</para>
   259 
   260 	<para>
   261 	  If x is 0, and y greater than 0 and not an odd integer, the result
   262 	  is 0.
   263 	</para>
   264 
   265 	<para>
   266 	  If x is 0, and y is less than 0,
   267 	  &lt;pow&gt; returns an indeterminate result. 
   268 	</para>
   269     </simplesect>
   270 
   271     <example>
   272       <programlisting>
   273   &lt;libxexpr:pow&gt;10 2&lt;/libxexpr:pow&gt; --> &lt;float&gt;100&lt;/float&gt;<!--
   274    --></programlisting>
   275     </example>
   276   </sect1>
   277 </chapter>