2 <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
6 <chapter id="language-extensions">
7 <title>Language Extensions</title>
10 These language extensions are provided in the following namespace URI:
12 http://www.juiblex.co.uk/ns/libxexpr
14 People using this namespace are encouraged to use the libxexpr namespace
18 <sect1 id="libxexpr-pi">
19 <title>Function <pi></title>
22 <title>Synopsis</title>
24 <pi> returns the value of π.
29 <title>Arguments</title>
31 <pi> takes no arguments.
36 <title>Return Values</title>
38 <pi> returns the value of π.
44 <libxexpr:pi/> ≅ <float>3.14</float><!--
49 <sect1 id="libxexpr-sin">
50 <title>Function <sin></title>
53 <title>Synopsis</title>
55 <sin> computes the sine function.
60 <title>Arguments</title>
62 <sin> takes one argument: x. If no argument is given, an error
68 <title>Return Values</title>
70 <sin> returns the sine of its argument, given in radians.
71 If the argument does not evaluate to a finite number,
72 <sin> returns an indeterminate result.
83 </libxexpr:sin> --> <float>1</float><!--
88 <sect1 id="libxexpr-atan">
89 <title>Function <atan></title>
92 <title>Synopsis</title>
94 <atan> computes the arc tangent function.
99 <title>Arguments</title>
101 <atan> takes two arguments: x and y. The y argument defaults to
102 1. If the x argument is missing, an error occurs.
107 <title>Return Values</title>
109 <atan> 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.
115 If two arguments are given, <atan> 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.
122 If only one argument is given, <atan> returns the arc tangent of
123 its argument. The result will be in the range [-π/2, π/2].
129 <libxexpr:atan>1 0</libxexpr:atan> --> <float>0</float><!--
134 <sect1 id="libxexpr-exp">
135 <title>Function <exp></title>
138 <title>Synopsis</title>
140 <exp> computes the base-e exponential function.
145 <title>Arguments</title>
147 <exp> takes zero or one argument: x.
152 <title>Return Values</title>
154 <exp> 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 <exp> returns an indeterminate result.
163 <libxexpr:exp>2</libxexpr:exp> ≅ <float>7.389</float><!--
168 <sect1 id="libxexpr-log">
169 <title>Function <log></title>
172 <title>Synopsis</title>
174 <log> computes the natural logarithmic function.
179 <title>Arguments</title>
181 <log> takes one argument: x. If no argument is given, an error
187 <title>Return Values</title>
189 <log> returns the natural logarithm of its argument.
190 If the argument does not evaluate to a positive finite number,
191 <log> returns an indeterminate result.
198 <libxexpr:exp>2</libxexpr:exp>
199 </libxexpr:log> --> <float>2</float><!--
204 <sect1 id="libxexpr-pow">
205 <title>Function <pow></title>
208 <title>Synopsis</title>
210 <pow> computes the value of its first argument raised to the
211 power of its second argument.
216 <title>Arguments</title>
218 <pow> takes two arguments: x and y. If fewer arguments are
219 given, an error occurs.
224 <title>Return Values</title>
226 <pow> returns the value of x (its first argument) raised to the
227 power of y (its second argument).
231 If x is a finite value less than 0, and y is a finite non-integer,
232 <pow> returns an indeterminate result.
236 If the result overflows, <pow> returns an indeterminate result.
240 If result underflows, and is not representable, 0 is returned.
244 Except as specified below, if either argument is indeterminate,
245 the result is also indeterminate.
249 If x is 1, the result is 1 (even if y is indeterminate).
253 If y is 0, the result is 1 (even if x is indeterminate).
257 If x is 0, and y is an odd integer greater than 0, the result is 0.
261 If x is 0, and y greater than 0 and not an odd integer, the result
266 If x is 0, and y is less than 0,
267 <pow> returns an indeterminate result.
273 <libxexpr:pow>10 2</libxexpr:pow> --> <float>100</float><!--