| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
4.2 Elementary functions
Each of the classes cl_N, cl_R, cl_RA, cl_I,
cl_F, cl_SF, cl_FF, cl_DF, cl_LF
defines the following operations:
type operator + (const type&, const type&)-
Addition.
type operator - (const type&, const type&)-
Subtraction.
type operator - (const type&)Returns the negative of the argument.
type plus1 (const type& x)-
Returns
x + 1. type minus1 (const type& x)-
Returns
x - 1. type operator * (const type&, const type&)-
Multiplication.
type square (const type& x)-
Returns
x * x.
Each of the classes cl_N, cl_R, cl_RA,
cl_F, cl_SF, cl_FF, cl_DF, cl_LF
defines the following operations:
type operator / (const type&, const type&)-
Division.
type recip (const type&)-
Returns the reciprocal of the argument.
The class cl_I doesn’t define a ‘/’ operation because
in the C/C++ language this operator, applied to integral types,
denotes the ‘floor’ or ‘truncate’ operation (which one of these,
is implementation dependent). (See section Rounding functions.)
Instead, cl_I defines an “exact quotient” function:
The following exponentiation functions are defined:
cl_I expt_pos (const cl_I& x, const cl_I& y)cl_RA expt_pos (const cl_RA& x, const cl_I& y)ymust be > 0. Returnsx^y.cl_RA expt (const cl_RA& x, const cl_I& y)cl_R expt (const cl_R& x, const cl_I& y)cl_N expt (const cl_N& x, const cl_I& y)Returns
x^y.
Each of the classes cl_R, cl_RA, cl_I,
cl_F, cl_SF, cl_FF, cl_DF, cl_LF
defines the following operation:
The class cl_N implements this as follows:
cl_R abs (const cl_N x)Returns the absolute value of
x.
Each of the classes cl_N, cl_R, cl_RA, cl_I,
cl_F, cl_SF, cl_FF, cl_DF, cl_LF
defines the following operation:
type signum (const type& x)-
Returns the sign of
x, in the same number format asx. This is defined asx / abs(x)ifxis non-zero, andxifxis zero. Ifxis real, the value is either 0 or 1 or -1.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on August 27, 2013 using texi2html 5.0.
