Skip to main content

Module arithmetic

Module arithmetic 

Source
Expand description

Traits for arithmetic.

Modules§

abs
Absolute value of Floats.
abs_squared
Implementations of AbsSquared and AbsSquaredAssign, traits for computing the squared absolute value of a number. For real types this is the same as squaring.
acos
Implementations of Acos and AcosAssign, traits for computing the arccosine of Floats.
acot
acsc
add
Addition of Floats, and of Floats with Rationals.
add_mul
AddMul and AddMulAssign, traits for adding a Float and the product of two other Floats — or of a Float and a Rational — with a single rounding (fused multiply-add), and the associated precision- and rounding-mode-aware functions.
agm
Taking the AGM (arithmetic-geometric mean) of two Floats, and of Floats with Rationals.
asec
Implementations of Asec and AsecAssign, traits for computing the arcsecant of Floats.
asin
Implementations of Asin and AsinAssign, traits for computing the arcsine of Floats.
atan
Implementations of Atan and AtanAssign, traits for computing the arctangent of Floats.
atan2
Implementations of Atan2 and Atan2Assign, traits for computing the angle of a point given by two Float coordinates.
average
Average and AverageAssign, traits for computing the average (arithmetic mean) of two numbers, and the associated precision- and rounding-mode-aware functions.
canonical_unit_i_pow
An implementation of CanonicalUnitIPow, a trait for finding the power of $i$ that brings a number into canonical unit form.
canonicalize_unit
Implementations of CanonicalizeUnit and CanonicalizeUnitAssign, traits for bringing a number into canonical unit form.
cbrt
Cube root of Floats and of Rationals.
compound
Compound and CompoundAssign, traits for computing the compound function $(1+x)^n$ for Floats.
conjugate
Implementations of Conjugate and ConjugateAssign, traits for computing the complex conjugate of a number. A real number is its own conjugate.
cos
Implementations of Cos and CosAssign, traits for computing the cosine of Floats.
cot
Implementations of Cot and CotAssign, traits for computing the cotangent of Floats.
csc
Implementations of Csc and CscAssign, traits for computing the cosecant of Floats.
div
Division of Floats, of Floats by Rationals, and of Rationals by Floats.
dot
Correctly-rounded dot products of Float slices, with the products computed exactly and a single rounding at the end, so that intermediate overflow and underflow cannot occur.
exp
Exp and ExpAssign, traits for computing $e^x$ for Floats.
exp_x_minus_1
ExpXMinus1 and ExpXMinus1Assign, traits for computing $e^x-1$ for Floats.
factorial
factorial_prec_round and factorial_prec, for computing correctly-rounded factorials.
fractional_part
Fractional parts of Floats: the fractional_part and integer_and_fractional_parts families.
hypot
Hypot and HypotAssign, traits for computing the hypotenuse of two numbers, $\sqrt{x^2+y^2}$.
is_power_of_2
An implementation of IsPowerOf2, a trait for determining whether a number is an integer power of 2.
is_unit
An implementation of IsUnit, a trait for determining whether a number is a unit of its ring.
ln
Ln and LnAssign, traits for computing the natural logarithm of Floats.
ln_1_plus_x
Ln1PlusX and Ln1PlusXAssign, traits for computing $\ln(1+x)$ for Floats.
log_base
LogBase and LogBaseAssign, traits for computing the base-$b$ logarithm of Floats for an arbitrary integer base $b>1$.
log_base_2
LogBase2 and LogBase2Assign, traits for computing the base-2 logarithm of Floats.
log_base_1_plus_x
LogBaseOf1PlusX and LogBaseOf1PlusXAssign, traits for computing $\log_b(1+x)$ of Floats for an arbitrary integer base $b>1$.
log_base_2_1_plus_x
LogBase2Of1PlusX and LogBase2Of1PlusXAssign, traits for computing $\log_2(1+x)$ for Floats.
log_base_10
LogBase10 and LogBase10Assign, traits for computing the base-10 logarithm of Floats.
log_base_10_1_plus_x
LogBase10Of1PlusX and LogBase10Of1PlusXAssign, traits for computing $\log_{10}(1+x)$ of Floats.
log_base_float_base
LogBase and LogBaseAssign, implemented for a Float base, for computing $\log_b x$ of a Float with an arbitrary Float base.
log_base_float_base_1_plus_x
LogBaseOf1PlusX and LogBaseOf1PlusXAssign, implemented for a Float base, for computing $\log_b(1+x)$ of a Float with an arbitrary Float base.
log_base_power_of_2
LogBasePowerOf2 and LogBasePowerOf2Assign, traits for computing $\log_{2^k} x$ for Floats.
log_base_power_of_2_1_plus_x
LogBasePowerOf2Of1PlusX and LogBasePowerOf2Of1PlusXAssign, traits for computing $\log_{2^k}(1+x)$ for Floats.
log_base_rational_base
LogBase and LogBaseAssign, implemented for a Rational base, for computing $\log_b x$ of a Float with an arbitrary rational base $b>1$.
log_base_rational_base_1_plus_x
LogBaseOf1PlusX and LogBaseOf1PlusXAssign, implemented for a Rational base, for computing $\log_b(1+x)$ of a Float with an arbitrary rational base $b>1$.
log_base_rational_float_base
Functions for computing $\log_b x$ of a Rational $x$ with an arbitrary Float base, returning a Float.
log_base_rational_rational_base
Functions for computing $\log_b x$ of a Rational $x$ with an arbitrary Rational base $b>1$, returning a Float.
mul
Multiplication of Floats, and of Floats with Rationals.
mul_add_mul
MulAddMul and MulAddMulAssign, traits for adding the products of two pairs of Floats with a single rounding, and the associated precision- and rounding-mode-aware functions.
mul_sub_mul
MulSubMul and MulSubMulAssign, traits for subtracting the product of one pair of Floats from the product of another pair with a single rounding, and the associated precision- and rounding-mode-aware functions.
neg
Negation of Floats.
positive_difference
positive_difference_prec_round and related functions, for computing positive differences of Floats.
pow
Implementations of PowerOf2, a trait for computing a power of 2.
power_of_2
power_of_2_of_float
power_of_2_x_minus_1
Implementations of PowerOf2XMinus1 and PowerOf2XMinus1Assign, traits for computing $2^x-1$.
power_of_10
An implementation of PowerOf2 with a Float exponent, computing $2^x$ for Floats.
power_of_10_x_minus_1
product
Correctly-rounded multiplication of any number of Floats: functions computing a slice’s product with a single rounding at the end, and the Product implementations built on them.
reciprocal
Implementations of Reciprocal and ReciprocalAssign, traits for computing the reciprocal of a number.
reciprocal_sqrt
ReciprocalSqrt and ReciprocalSqrtAssign, traits for computing the reciprocal of the square root of Floats.
rem
rem_prec_round and related functions, for computing floating-point remainders of Floats.
root
root_u_prec_round and related functions, for computing roots of Floats.
round_to_integer
sec
Implementations of Sec and SecAssign, traits for computing the secant of Floats.
shl
Left-shifting a Float (multiplying it by a power of 2).
shl_round
Implementations of ShlRound and ShlRoundAssign, traits for multiplying a number by a power of 2 and rounding according to a specified RoundingMode. For Floats, rounding is only necessary in the cases of overflow and underflow.
shr
Right-shifting a Float (dividing it by a power of 2).
shr_round
Implementations of ShlRound and ShrRoundAssign, traits for dividing a number by a power of 2 and rounding according to a specified RoundingMode. For Floats, rounding is only necessary in the cases of overflow and underflow.
sign
An implementation of Sign, a trait for determining the sign of a number.
sin
Implementations of Sin and SinAssign, traits for computing the sine of Floats.
sin_cos
Implementations of SinCos and SinCosAssign, traits for computing the sine and cosine of Floats together.
sqrt
Sqrt and SqrtAssign, traits for computing the square root of Floats.
square
Squaring of Floats.
sub
Subtraction of Floats, of Floats by Rationals, and of Rationals by Floats.
sub_mul
SubMul and SubMulAssign, traits for subtracting the product of two Floats — or of a Float and a Rational — from another Float with a single rounding (fused multiply-subtract), and the associated precision- and rounding-mode-aware functions.
sum
Correctly-rounded summation of any number of Floats: functions computing a slice’s sum with a single rounding at the end, and the Sum implementations built on them.
tan