1 \section{Built-in Module
\module{math
}}
5 This module is always available.
6 It provides access to the mathematical functions defined by the
\C{}
10 \begin{funcdesc
}{acos
}{x
}
11 Return the arc cosine of
\var{x
}.
14 \begin{funcdesc
}{asin
}{x
}
15 Return the arc sine of
\var{x
}.
18 \begin{funcdesc
}{atan
}{x
}
19 Return the arc tangent of
\var{x
}.
22 \begin{funcdesc
}{atan2
}{x, y
}
23 Return
\code{atan(
\var{x
} /
\var{y
})
}.
26 \begin{funcdesc
}{ceil
}{x
}
27 Return the ceiling of
\var{x
} as a real.
30 \begin{funcdesc
}{cos
}{x
}
31 Return the cosine of
\var{x
}.
34 \begin{funcdesc
}{cosh
}{x
}
35 Return the hyperbolic cosine of
\var{x
}.
38 \begin{funcdesc
}{exp
}{x
}
39 Return
\code{e**
\var{x
}}.
42 \begin{funcdesc
}{fabs
}{x
}
43 Return the absolute value of the real
\var{x
}.
46 \begin{funcdesc
}{floor
}{x
}
47 Return the floor of
\var{x
} as a real.
50 \begin{funcdesc
}{fmod
}{x, y
}
51 Return
\code{\var{x
} \%\
\var{y
}}.
54 \begin{funcdesc
}{frexp
}{x
}
55 Return the matissa and exponent for
\var{x
}. The mantissa is
59 \begin{funcdesc
}{hypot
}{x, y
}
60 Return the Euclidean distance,
\code{sqrt(
\var{x
}*
\var{x
} +
\var{y
}*
\var{y
})
}.
63 \begin{funcdesc
}{ldexp
}{x, i
}
64 Return
\code{\var{x
} * (
2**
\var{i
})
}.
67 \begin{funcdesc
}{log
}{x
}
68 Return the natural logarithm of
\var{x
}.
71 \begin{funcdesc
}{log10
}{x
}
72 Return the base-
10 logarithm of
\var{x
}.
75 \begin{funcdesc
}{modf
}{x
}
76 Return the fractional and integer parts of
\var{x
}. Both results
77 carry the sign of
\var{x
}. The integer part is returned as a real.
80 \begin{funcdesc
}{pow
}{x, y
}
81 Return
\code{\var{x
}**
\var{y
}}.
84 \begin{funcdesc
}{sin
}{x
}
85 Return the sine of
\var{x
}.
88 \begin{funcdesc
}{sinh
}{x
}
89 Return the hyperbolic sine of
\var{x
}.
92 \begin{funcdesc
}{sqrt
}{x
}
93 Return the square root of
\var{x
}.
96 \begin{funcdesc
}{tan
}{x
}
97 Return the tangent of
\var{x
}.
100 \begin{funcdesc
}{tanh
}{x
}
101 Return the hyperbolic tangent of
\var{x
}.
104 Note that
\function{frexp()
} and
\function{modf()
} have a different
105 call/return pattern than their
\C{} equivalents: they take a single
106 argument and return a pair of values, rather than returning their
107 second return value through an `output parameter' (there is no such
110 The module also defines two mathematical constants:
113 The mathematical constant
\emph{pi
}.
117 The mathematical constant
\emph{e
}.
121 \seemodule{cmath
}{Complex number versions of many of these functions.
}