Struct rugflo::Float
[−]
[src]
pub struct Float { /* fields omitted */ }
A multi-precision floating-point number. The precision has to be set during construction.
There are two versions of most methods:
- The first rounds the returned or stored
Float
to the nearest representable value. - The second applies the specified rounding
method, and returns the rounding direction:
Ordering::Less
if the returned/storedFloat
is less than the exact result,Ordering::Equal
if the returned/storedFloat
is equal to the exact result,Ordering::Greater
if the returned/storedFloat
is greater than the exact result,
Methods
impl Float
[src]
fn new(prec: u32) -> Float
Create a new floating-point number with the specified precision and with value 0.
Panics
Panics if prec
is out of the allowed range.
fn prec(&self) -> u32
Returns the precision of self
.
fn set_prec(&mut self, prec: u32)
Sets the precision of self
exactly, rounding to the nearest.
Panics
Panics if prec
is out of the allowed range.
fn set_prec_round(&mut self, prec: u32, round: Round) -> Ordering
Sets the precision of self
exactly, applying the specified
rounding method.
Panics
Panics if prec
is out of the allowed range.
fn to_integer(&self) -> Integer
Converts to an integer, rounding to the nearest.
fn to_integer_round(&self, round: Round) -> (Integer, Ordering)
Converts to an integer, applying the specified rounding method.
fn to_integer_exp(&self) -> Option<(Integer, i32)>
If self
is a finite number, returns an
integer and exponent such that self
is exactly equal to the
integer multiplied by two raised to the power of the exponent.
Examples
extern crate rugint; extern crate rugflo; use rugint::Assign; use rugflo::{Float, Special}; fn main() { let mut float = Float::from((6.5, 16)); // 6.5 in binary is 110.1 // Since the precision is 16 bits, this becomes // 1101_0000_0000_0000 times two to the power of -12 let (int, exp) = float.to_integer_exp().unwrap(); assert!(int == 0b1101_0000_0000_0000); assert!(exp == -13); float.assign(0); let (zero, _) = float.to_integer_exp().unwrap(); assert!(zero == 0); float.assign(Special::Infinity); assert!(float.to_integer_exp().is_none()); }
fn to_u32(&self) -> Option<u32>
Converts to a u32
, rounding to the nearest.
If the value is too small or too large for the target type,
the minimum or maximum value allowed is returned.
If the value is a NaN, None
is returned.
fn to_i32(&self) -> Option<i32>
Converts to an i32
, rounding to the nearest.
If the value is too small or too large for the target type,
the minimum or maximum value allowed is returned.
If the value is a NaN, None
is returned.
fn to_f64(&self) -> f64
Converts to an f64
, rounding to the nearest.
If the value is too small or too large for the target type,
the minimum or maximum value allowed is returned.
fn to_f32(&self) -> f32
Converts to an f32
, rounding to the nearest.
If the value is too small or too large for the target type,
the minimum or maximum value allowed is returned.
fn to_u32_round(&self, round: Round) -> Option<u32>
Converts to a u32
, applying the specified rounding method.
If the value is too small or too large for the target type,
the minimum or maximum value allowed is returned.
If the value is a NaN, None
is returned.
fn to_i32_round(&self, round: Round) -> Option<i32>
Converts to an i32
, applying the specified rounding method.
If the value is too small or too large for the target type,
the minimum or maximum value allowed is returned.
If the value is a NaN, None
is returned.
fn to_f64_round(&self, round: Round) -> f64
Converts to an f64
, applying the specified rounding method.
If the value is too small or too large for the target type,
the minimum or maximum value allowed is returned.
fn to_f32_round(&self, round: Round) -> f32
Converts to an f32
, applying the specified rounding method.
If the value is too small or too large for the target type,
the minimum or maximum value allowed is returned.
fn square(&mut self) -> &mut Float
Computes the square, rounding to the nearest.
fn square_round(&mut self, round: Round) -> Ordering
Computes the square, applying the specified rounding method.
fn sqrt(&mut self) -> &mut Float
Computes the square root, rounding to the nearest.
fn sqrt_round(&mut self, round: Round) -> Ordering
Computes the square root, applying the specified rounding method.
fn set_sqrt(&mut self, u: u32) -> &mut Float
Sets self
to the square root of u
,
rounding to the nearest.
fn set_sqrt_round(&mut self, u: u32, round: Round) -> Ordering
Sets self
to the square root of u
,
applying the specified rounding method.
fn recip_sqrt(&mut self) -> &mut Float
Computes the reciprocal square root, rounding to the nearest.
fn recip_sqrt_round(&mut self, round: Round) -> Ordering
Computes the reciprocal square root, applying the specified rounding method.
fn cbrt(&mut self) -> &mut Float
Computes the cube root, rounding to the nearest.
fn cbrt_round(&mut self, round: Round) -> Ordering
Computes the cube root, applying the specified rounding method.
fn root(&mut self, k: u32) -> &mut Float
Computes the k
th root, rounding to the nearest.
fn root_round(&mut self, k: u32, round: Round) -> Ordering
Computes the k
th root, applying the specified rounding method.
fn abs(&mut self) -> &mut Float
Computes the absolute value, rounding to the nearest.
fn recip(&mut self) -> &mut Float
Computes the reciprocal, rounding to the nearest.
fn recip_round(&mut self, round: Round) -> Ordering
Computes the reciprocal, applying the specified rounding method.
fn dim(&mut self, other: &Float) -> &mut Float
Computes the positive difference between self
and other
, rounding to the nearest.
fn dim_round(&mut self, other: &Float, round: Round) -> Ordering
Computes the arithmetic-geometric mean of self
and other
, applying the specified rounding method.
fn cmp_abs(&self, other: &Float) -> Option<Ordering>
Compares the absolute values of self
and other
.
fn ln(&mut self) -> &mut Float
Computes the natural logarithm, rounding to the nearest.
fn ln_round(&mut self, round: Round) -> Ordering
Computes the natural logarithm, applying the specified rounding method.
fn log2(&mut self) -> &mut Float
Computes the logarithm to base 2, rounding to the nearest.
fn log2_round(&mut self, round: Round) -> Ordering
Computes the logarithm to base 2, applying the specified rounding method.
fn log10(&mut self) -> &mut Float
Computes the logarithm to base 10, rounding to the nearest.
fn log10_round(&mut self, round: Round) -> Ordering
Computes the logarithm to base 10, applying the specified rounding method.
fn exp(&mut self) -> &mut Float
Computes the exponential, rounding to the nearest.
fn exp_round(&mut self, round: Round) -> Ordering
Computes the exponential, applying the specified rounding method.
fn exp2(&mut self) -> &mut Float
Computes 2 to the power of self
, rounding to the nearest.
fn exp2_round(&mut self, round: Round) -> Ordering
Computes 2 to the power of self
, applying the specified rounding method.
fn exp10(&mut self) -> &mut Float
Computes 10 to the power of self
, rounding to the nearest.
fn exp10_round(&mut self, round: Round) -> Ordering
Computes 10 to the power of self
, applying the specified rounding method.
fn cos(&mut self) -> &mut Float
Computes the cosine, rounding to the nearest.
fn cos_round(&mut self, round: Round) -> Ordering
Computes the cosine, applying the specified rounding method.
fn sin(&mut self) -> &mut Float
Computes the sine, rounding to the nearest.
fn sin_round(&mut self, round: Round) -> Ordering
Computes the sine, applying the specified rounding method.
fn tan(&mut self) -> &mut Float
Computes the tangent, rounding to the nearest.
fn tan_round(&mut self, round: Round) -> Ordering
Computes the tangent, applying the specified rounding method.
fn sin_cos(&mut self, buf: &mut Float)
Computes the sine and cosine, rounding to the nearest. The
sine is stored in self
and keeps its precision, while the
cosine is stored in buf
keeping its precision.
fn sin_cos_round(&mut self,
buf: &mut Float,
round: Round)
-> (Ordering, Ordering)
buf: &mut Float,
round: Round)
-> (Ordering, Ordering)
Computes the sine and cosine, applying the specified rounding
method. The sine is stored in self
and keeps its precision,
while the cosine is stored in buf
keeping its precision.
fn sec(&mut self) -> &mut Float
Computes the secant, rounding to the nearest.
fn sec_round(&mut self, round: Round) -> Ordering
Computes the secant, applying the specified rounding method.
fn csc(&mut self) -> &mut Float
Computes the cosecant, rounding to the nearest.
fn csc_round(&mut self, round: Round) -> Ordering
Computes the cosecant, applying the specified rounding method.
fn cot(&mut self) -> &mut Float
Computes the cotangent, rounding to the nearest.
fn cot_round(&mut self, round: Round) -> Ordering
Computes the cotangent, applying the specified rounding method.
fn acos(&mut self) -> &mut Float
Computes the arc-cosine, rounding to the nearest.
fn acos_round(&mut self, round: Round) -> Ordering
Computes the arc-cosine, applying the specified rounding method.
fn asin(&mut self) -> &mut Float
Computes the arc-sine, rounding to the nearest.
fn asin_round(&mut self, round: Round) -> Ordering
Computes the arc-sine, applying the specified rounding method.
fn atan(&mut self) -> &mut Float
Computes the arc-tangent, rounding to the nearest.
fn atan_round(&mut self, round: Round) -> Ordering
Computes the arc-tangent, applying the specified rounding method.
fn atan2(&mut self, other: &Float) -> &mut Float
Computes the arc-tangent2 of self
and other
, rounding to the nearest.
This is similar to the arc-tangent of self / other
, except in the cases when either self
or other
or both are zero or infinity.
fn atan2_round(&mut self, other: &Float, round: Round) -> Ordering
Computes the arc-tangent2 of self
and other
, applying the specified rounding method.
This is similar to the arc-tangent of self / other
, except in the cases when either self
or other
or both are zero or infinity.
fn cosh(&mut self) -> &mut Float
Computes the hyperbolic cosine, rounding to the nearest.
fn cosh_round(&mut self, round: Round) -> Ordering
Computes the hyperbolic cosine, applying the specified rounding method.
fn sinh(&mut self) -> &mut Float
Computes the hyperbolic sine, rounding to the nearest.
fn sinh_round(&mut self, round: Round) -> Ordering
Computes the hyperbolic sine, applying the specified rounding method.
fn tanh(&mut self) -> &mut Float
Computes the hyperbolic tangent, rounding to the nearest.
fn tanh_round(&mut self, round: Round) -> Ordering
Computes the hyperbolic tangent, applying the specified rounding method.
fn sinh_cosh(&mut self, buf: &mut Float)
Computes the hyperbolic sine and cosine, rounding to the
nearest. The sine is stored in self
and keeps its precision,
while the cosine is stored in buf
keeping its precision.
fn sinh_cosh_round(&mut self,
buf: &mut Float,
round: Round)
-> (Ordering, Ordering)
buf: &mut Float,
round: Round)
-> (Ordering, Ordering)
Computes the hyperbolic sine and cosine, applying the
specified rounding method. The sine is stored in self
and
keeps its precision, while the cosine is stored in buf
keeping its precision.
fn sech(&mut self) -> &mut Float
Computes the hyperbolic secant, rounding to the nearest.
fn sech_round(&mut self, round: Round) -> Ordering
Computes the hyperbolic secant, applying the specified rounding method.
fn csch(&mut self) -> &mut Float
Computes the hyperbolic cosecant, rounding to the nearest.
fn csch_round(&mut self, round: Round) -> Ordering
Computes the hyperbolic cosecant, applying the specified rounding method.
fn coth(&mut self) -> &mut Float
Computes the hyperbolic cotangent, rounding to the nearest.
fn coth_round(&mut self, round: Round) -> Ordering
Computes the hyperbolic cotangent, applying the specified rounding method.
fn acosh(&mut self) -> &mut Float
Computes the inverse hyperbolic cosine, rounding to the nearest.
fn acosh_round(&mut self, round: Round) -> Ordering
Computes the inverse hyperbolic cosine, applying the specified rounding method.
fn asinh(&mut self) -> &mut Float
Computes the inverse hyperbolic sine, rounding to the nearest.
fn asinh_round(&mut self, round: Round) -> Ordering
Computes the inverse hyperbolic sine, applying the specified rounding method.
fn atanh(&mut self) -> &mut Float
Computes the inverse hyperbolic tangent, rounding to the nearest.
fn atanh_round(&mut self, round: Round) -> Ordering
Computes the inverse hyperbolic tangent, applying the specified rounding method.
fn set_factorial(&mut self, u: u32) -> &mut Float
Sets self
to the factorial of u
,
rounding to the nearest.
fn set_factorial_round(&mut self, u: u32, round: Round) -> Ordering
Sets self
to the factorial of u
,
applying the specified rounding method.
fn ln_1p(&mut self) -> &mut Float
Computes the natural logarithm of one plus self
, rounding to the nearest.
fn ln_1p_round(&mut self, round: Round) -> Ordering
Computes the natural logarithm of one plus self
, applying the specified rounding method.
fn exp_m1(&mut self) -> &mut Float
Subtracts one from the exponential of self
, rounding to the nearest.
fn exp_m1_round(&mut self, round: Round) -> Ordering
Subtracts one from the exponential of self
, applying the specified rounding method.
fn eint(&mut self) -> &mut Float
Computes the exponential integral of self
, rounding to the nearest.
fn eint_round(&mut self, round: Round) -> Ordering
Computes the exponential integral of self
, applying the specified rounding method.
fn li2(&mut self) -> &mut Float
Computes the real part of the dilogarithm of self
, rounding to the nearest.
fn li2_round(&mut self, round: Round) -> Ordering
Computes the real part of the dilogarithm of self
, applying the specified rounding method.
fn gamma(&mut self) -> &mut Float
Computes the value of the Gamma function on self
, rounding to the nearest.
fn gamma_round(&mut self, round: Round) -> Ordering
Computes the value of the Gamma function on self
, applying the specified rounding method.
fn ln_gamma(&mut self) -> &mut Float
Computes the logarithm of the Gamma function on self
, rounding to the nearest.
fn ln_gamma_round(&mut self, round: Round) -> Ordering
Computes the logarithm of the Gamma function on self
, applying the specified rounding method.
fn lgamma(&mut self) -> Ordering
Computes the logarithm of the absolute value of the Gamma
function on self
, rounding to the nearest. Returns
Ordering::Less
if the Gamma function is negative, or
Ordering::Greater
if the Gamma function is positive.
fn lgamma_round(&mut self, round: Round) -> (Ordering, Ordering)
Computes the logarithm of the absolute value of the Gamma
function on self
, applying the specified rounding method.
The returned tuple contains:
- The logarithm of the absolute value of the Gamma function.
- The rounding direction.
fn digamma(&mut self) -> &mut Float
Computes the value of the Digamma function on self
, rounding to the nearest.
fn digamma_round(&mut self, round: Round) -> Ordering
Computes the value of the Digamma function on self
, applying the specified rounding method.
fn zeta(&mut self) -> &mut Float
Computes the value of the Riemann Zeta function on self
, rounding to the nearest.
fn zeta_round(&mut self, round: Round) -> Ordering
Computes the value of the Riemann Zeta function on self
, applying the specified rounding method.
fn set_zeta(&mut self, u: u32) -> &mut Float
Sets self
to the value of the Riemann Zeta function on u
,
rounding to the nearest.
fn set_zeta_round(&mut self, u: u32, round: Round) -> Ordering
Sets self
to the value of the Riemann Zeta function on u
,
applying the specified rounding method.
fn erf(&mut self) -> &mut Float
Computes the value of the error function on self
, rounding to the nearest.
fn erf_round(&mut self, round: Round) -> Ordering
Computes the value of the error function on self
, applying the specified rounding method.
fn erfc(&mut self) -> &mut Float
Computes the value of the complementary error function on self
, rounding to the nearest.
fn erfc_round(&mut self, round: Round) -> Ordering
Computes the value of the complementary error function on self
, applying the specified rounding method.
fn j0(&mut self) -> &mut Float
Computes the value of the first kind Bessel function of order 0 on self
, rounding to the nearest.
fn j0_round(&mut self, round: Round) -> Ordering
Computes the value of the first kind Bessel function of order 0 on self
, applying the specified rounding method.
fn j1(&mut self) -> &mut Float
Computes the value of the first kind Bessel function of order 1 on self
, rounding to the nearest.
fn j1_round(&mut self, round: Round) -> Ordering
Computes the value of the first kind Bessel function of order 1 on self
, applying the specified rounding method.
fn jn(&mut self, n: i32) -> &mut Float
Computes the value of the first kind Bessel function of order n
on self
, rounding to the nearest.
fn jn_round(&mut self, n: i32, round: Round) -> Ordering
Computes the value of the first kind Bessel function of order n
on self
, applying the specified rounding method.
fn y0(&mut self) -> &mut Float
Computes the value of the second kind Bessel function of order 0 on self
, rounding to the nearest.
fn y0_round(&mut self, round: Round) -> Ordering
Computes the value of the second kind Bessel function of order 0 on self
, applying the specified rounding method.
fn y1(&mut self) -> &mut Float
Computes the value of the second kind Bessel function of order 1 on self
, rounding to the nearest.
fn y1_round(&mut self, round: Round) -> Ordering
Computes the value of the second kind Bessel function of order 1 on self
, applying the specified rounding method.
fn yn(&mut self, n: i32) -> &mut Float
Computes the value of the second kind Bessel function of order n
on self
, rounding to the nearest.
fn yn_round(&mut self, n: i32, round: Round) -> Ordering
Computes the value of the second kind Bessel function of order n
on self
, applying the specified rounding method.
fn agm(&mut self, other: &Float) -> &mut Float
Computes the arithmetic-geometric mean of self
and other
, rounding to the nearest.
fn agm_round(&mut self, other: &Float, round: Round) -> Ordering
Computes the arithmetic-geometric mean of self
and other
, applying the specified rounding method.
fn hypot(&mut self, other: &Float) -> &mut Float
Computes the Euclidean norm of self
and other
, rounding to the nearest.
fn hypot_round(&mut self, other: &Float, round: Round) -> Ordering
Computes the Euclidean norm of self
and other
, applying the specified rounding method.
fn ai(&mut self) -> &mut Float
Computes the value of the Airy function Ai on self
, rounding to the nearest.
fn ai_round(&mut self, round: Round) -> Ordering
Computes the value of the Airy function Ai on self
, applying the specified rounding method.
fn ceil(&mut self) -> &mut Float
Rounds up to the next higher integer, then rounds to the nearest. This function performs double rounding.
fn ceil_round(&mut self, round: Round) -> Ordering
Rounds up to the next higher integer, then applies the specified rounding method. This function performs double rounding.
fn floor(&mut self) -> &mut Float
Rounds down to the next lower integer, then rounds to the nearest. This function performs double rounding.
fn floor_round(&mut self, round: Round) -> Ordering
Rounds down to the next lower integer, then applies the specified rounding method. This function performs double rounding.
fn round(&mut self) -> &mut Float
Rounds to the nearest integer, rounding half-way cases away from zero, then rounds to the nearest representable value. This function performs double rounding.
fn round_round(&mut self, round: Round) -> Ordering
Rounds to the next lower integer, then applies the specified rounding method to get a representable value. This function performs double rounding.
fn trunc(&mut self) -> &mut Float
Rounds to the next integer towards zero, then rounds to the nearest. This function performs double rounding.
fn trunc_round(&mut self, round: Round) -> Ordering
Rounds to the next integer towards zero, then applies the specified rounding method. This function performs double rounding.
fn is_integer(&self) -> bool
Returns true
if self
is an integer.
fn is_nan(&self) -> bool
Returns true
if self
is not a number.
fn is_infinite(&self) -> bool
Returns true
if self
is plus or minus infinity.
fn is_finite(&self) -> bool
Returns true
if self
is a finite number,
that is neither NaN nor infinity.
fn is_zero(&self) -> bool
Returns true
if self
is plus or minus zero.
fn is_normal(&self) -> bool
Returns true
if self
is a normal number, that is neither
NaN, nor infinity, nor zero. Note that Float
cannot be
subnormal.
fn sign(&self) -> Ordering
Returns Less
if self
is less than zero,
Greater
if self
is greater than zero,
or Equal
if self
is equal to zero.
fn get_exp(&self) -> Option<i32>
Returns the exponent of self
if self
is a normal number,
otherwise None
.
The significand is assumed to be in the range [0.5,1).
fn get_sign(&self) -> bool
Returns the sign bit, that is true
if the number is negative.
fn subnormalize(&mut self) -> &mut Float
Emulate subnormal numbers, rounding to the nearest. This method has no effect if the value is not in the subnormal range.
fn subnormalize_round(&mut self,
prev_rounding: Ordering,
round: Round)
-> Ordering
prev_rounding: Ordering,
round: Round)
-> Ordering
Emulate subnormal numbers, applying the specified rounding
method. This method simply propagates prev_rounding
if the
value is not in the subnormal range.
fn assign_random_bits<R: Rng>(&mut self, rng: &mut R)
Generates a random number in the range 0 <= n < 1
.
This is equivalent to calling
assign_random_bits_round(rng, Round::Nearest)
.
fn assign_random_bits_round<R: Rng>(&mut self,
rng: &mut R,
round: Round)
-> Ordering
rng: &mut R,
round: Round)
-> Ordering
Generates a random number in the range 0 <= n < 1
.
This is equivalent to generating a random integer in the range
0 <= n < 2 ^ p
, where 2 ^ p
is two raised to the power of
the precision, and then dividing the integer by 2 ^ p
. The
smallest non-zero result will thus be 2 ^ -p
, and will only
have one bit set. In the smaller possible results, many bits
will be zero, and not all the precision will be used.
In all the normal cases, the result will be exact. However, if
the precision is very large, and the generated random number
is very small, this may require an exponent smaller than
rugflo::exp_min()
; in this case, rounding is applied and
the rounding direction is returned.
Examples
extern crate rand; extern crate rugflo; use rugflo::{Float, Round}; fn main() { let mut rng = rand::thread_rng(); let mut f = Float::new(2); f.assign_random_bits_round(&mut rng, Round::Nearest); assert!(f == 0.0 || f == 0.25 || f == 0.5 || f == 0.75); println!("0.0 <= {} < 1.0", f); }
fn assign_random_cont<R: Rng>(&mut self, rng: &mut R)
Generates a random number in the continuous range
0 <= n < 1
, and rounds to the nearest.
The rounded result can actually be equal to one.
This is equivalent to calling
assign_random_cont_round(rng, Round::Nearest)
.
fn assign_random_cont_round<R: Rng>(&mut self,
rng: &mut R,
round: Round)
-> Ordering
rng: &mut R,
round: Round)
-> Ordering
Generates a random number in the continous range
0 <= n < 1
and applies the specified rounding method.
The rounded result can actually be equal to one. Unlike
assign_random_bits_round()
which generates a discrete random number at intervals
depending on the precision, this method is equivalent to
generating a continuous random number with infinite precision
and then rounding the result. This means that even the smaller
numbers will be using all the available precision bits, and
rounding is performed in all cases, not in some corner case.
Examples
extern crate rand; extern crate rugflo; use rugflo::{Float, Round}; use std::cmp::Ordering; fn main() { let mut rng = rand::thread_rng(); let mut f = Float::new(2); let dir = f.assign_random_cont_round(&mut rng, Round::Nearest); // We cannot have an exact value without rounding. assert!(dir != Ordering::Equal); // The significand is either 0b10 or 0b11 // 10 11 assert!(f == 1.0 || f == 0.75 || f == 0.5 || f == 0.375 || f == 0.25 || f <= 0.1875); // If the result is 1.0, rounding was up. assert!(f != 1.0 || dir == Ordering::Greater); }
fn to_string_radix(&self, radix: i32) -> String
Returns a string representation of self
for the specified
radix
rounding to the nearest.
The exponent is encoded in decimal.
Panics
Panics if radix
is less than 2 or greater than 36.
fn to_string_radix_round(&self, radix: i32, round: Round) -> String
Returns a string representation of self
for the specified
radix
applying the specified rounding method.
The exponent is encoded in decimal.
Panics
Panics if radix
is less than 2 or greater than 36.
fn from_str(src: &str, prec: u32) -> Result<Float, ()>
Parses a Float
with the specified precision, rounding to the
nearest.
See the corresponding assignment.
fn from_str_radix(src: &str, radix: i32, prec: u32) -> Result<Float, ()>
Parses a Float
with the specified radix and precision,
rounding to the nearest.
See the corresponding assignment.
Panics
Panics if radix
is less than 2 or greater than 36.
fn from_str_round(src: &str,
prec: u32,
round: Round)
-> Result<(Float, Ordering), ()>
prec: u32,
round: Round)
-> Result<(Float, Ordering), ()>
Parses a Float
with the specified precision, applying the
specified rounding.
See the corresponding assignment.
fn from_str_radix_round(src: &str,
radix: i32,
prec: u32,
round: Round)
-> Result<(Float, Ordering), ()>
radix: i32,
prec: u32,
round: Round)
-> Result<(Float, Ordering), ()>
Parses a Float
with the specified radix and precision,
applying the specified rounding.
See the corresponding assignment.
Panics
Panics if radix
is less than 2 or greater than 36.
fn assign_str(&mut self, src: &str) -> Result<(), ()>
Parses a Float
from a string, rounding to the nearest.
Examples
use rugflo::Float; let mut f = Float::new(53); f.assign_str("12.5e2").unwrap(); assert!(f == 12.5e2); let ret = f.assign_str("bad"); assert!(ret.is_err());
fn assign_str_radix(&mut self, src: &str, radix: i32) -> Result<(), ()>
Parses a Float
from a string with the specified radix,
rounding to the nearest.
Examples
use rugflo::Float; let mut f = Float::new(53); f.assign_str_radix("f.f", 16).unwrap(); assert!(f == 15.9375);
Panics
Panics if radix
is less than 2 or greater than 36.
fn assign_str_round(&mut self, src: &str, round: Round) -> Result<Ordering, ()>
Parses a Float
from a string, applying the specified
rounding.
Examples
use rugflo::{Float, Round}; use std::cmp::Ordering; let mut f = Float::new(4); let dir = f.assign_str_round("14.1", Round::Down).unwrap(); assert!(f == 14); assert!(dir == Ordering::Less);
fn assign_str_radix_round(&mut self,
src: &str,
radix: i32,
round: Round)
-> Result<Ordering, ()>
src: &str,
radix: i32,
round: Round)
-> Result<Ordering, ()>
Parses a Float
from a string with the specified radix,
applying the specified rounding.
Examples
use rugflo::{Float, Round}; use std::cmp::Ordering; let mut f = Float::new(4); let dir = f.assign_str_radix_round("e.c", 16, Round::Up).unwrap(); assert!(f == 15); assert!(dir == Ordering::Greater);
Panics
Panics if radix
is less than 2 or greater than 36.
Trait Implementations
impl Drop for Float
[src]
impl Clone for Float
[src]
fn clone(&self) -> Float
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Float)
Performs copy-assignment from source
. Read more
impl<T> From<(T, i32)> for Float where Float: From<(T, u32)>
[src]
impl<T> FromRound<T, i32> for Float where Float: FromRound<T, u32, Round=Round, Ordering=Ordering>
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn from_round(t: T, prec: i32, round: Round) -> (Float, Ordering)
Performs the conversion.
impl From<(Constant, u32)> for Float
[src]
fn from((t, prec): (Constant, u32)) -> Float
Constructs a Float
from
a Constant
with the specified precision, rounding to the nearest.
impl FromRound<Constant, u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn from_round(t: Constant, prec: u32, round: Round) -> (Float, Ordering)
Constructs a Float
from
a Constant
with the specified precision, applying the specified
rounding method.
impl From<(Special, u32)> for Float
[src]
fn from((special, prec): (Special, u32)) -> Float
Constructs a Float
from a Special
with the specified
precision.
impl From<(Integer, u32)> for Float
[src]
fn from((t, prec): (Integer, u32)) -> Float
Constructs a Float
from
an Integer
with the specified precision, rounding to the nearest.
impl FromRound<Integer, u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn from_round(t: Integer, prec: u32, round: Round) -> (Float, Ordering)
Constructs a Float
from
an Integer
with the specified precision, applying the specified
rounding method.
impl From<(Rational, u32)> for Float
[src]
fn from((t, prec): (Rational, u32)) -> Float
Constructs a Float
from
a Rational
number
with the specified precision, rounding to the nearest.
impl FromRound<Rational, u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn from_round(t: Rational, prec: u32, round: Round) -> (Float, Ordering)
Constructs a Float
from
a Rational
number
with the specified precision, applying the specified
rounding method.
impl From<(Float, u32)> for Float
[src]
fn from((t, prec): (Float, u32)) -> Float
Constructs a Float
from
another Float
with the specified precision, rounding to the nearest.
impl FromRound<Float, u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn from_round(t: Float, prec: u32, round: Round) -> (Float, Ordering)
Constructs a Float
from
another Float
with the specified precision, applying the specified
rounding method.
impl<'a> From<(&'a Integer, u32)> for Float
[src]
fn from((t, prec): (&'a Integer, u32)) -> Float
Constructs a Float
from
an Integer
with the specified precision, rounding to the nearest.
impl<'a> FromRound<&'a Integer, u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn from_round(t: &'a Integer, prec: u32, round: Round) -> (Float, Ordering)
Constructs a Float
from
an Integer
with the specified precision, applying the specified
rounding method.
impl<'a> From<(&'a Rational, u32)> for Float
[src]
fn from((t, prec): (&'a Rational, u32)) -> Float
Constructs a Float
from
a Rational
number
with the specified precision, rounding to the nearest.
impl<'a> FromRound<&'a Rational, u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn from_round(t: &'a Rational, prec: u32, round: Round) -> (Float, Ordering)
Constructs a Float
from
a Rational
number
with the specified precision, applying the specified
rounding method.
impl<'a> From<(&'a Float, u32)> for Float
[src]
fn from((t, prec): (&'a Float, u32)) -> Float
Constructs a Float
from
another `Float
with the specified precision, rounding to the nearest.
impl<'a> FromRound<&'a Float, u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn from_round(t: &'a Float, prec: u32, round: Round) -> (Float, Ordering)
Constructs a Float
from
another `Float
with the specified precision, applying the specified
rounding method.
impl From<(u32, u32)> for Float
[src]
fn from((t, prec): (u32, u32)) -> Float
Constructs a Float
from
a u32
with the specified precision, rounding to the nearest.
impl FromRound<u32, u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn from_round(t: u32, prec: u32, round: Round) -> (Float, Ordering)
Constructs a Float
from
a u32
with the specified precision, applying the specified
rounding method.
impl From<(i32, u32)> for Float
[src]
fn from((t, prec): (i32, u32)) -> Float
Constructs a Float
from
an i32
with the specified precision, rounding to the nearest.
impl FromRound<i32, u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn from_round(t: i32, prec: u32, round: Round) -> (Float, Ordering)
Constructs a Float
from
an i32
with the specified precision, applying the specified
rounding method.
impl From<(f64, u32)> for Float
[src]
fn from((t, prec): (f64, u32)) -> Float
Constructs a Float
from
an f64
with the specified precision, rounding to the nearest.
impl FromRound<f64, u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn from_round(t: f64, prec: u32, round: Round) -> (Float, Ordering)
Constructs a Float
from
an f64
with the specified precision, applying the specified
rounding method.
impl From<(f32, u32)> for Float
[src]
fn from((t, prec): (f32, u32)) -> Float
Constructs a Float
from
an f32
with the specified precision, rounding to the nearest.
impl FromRound<f32, u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn from_round(t: f32, prec: u32, round: Round) -> (Float, Ordering)
Constructs a Float
from
an f32
with the specified precision, applying the specified
rounding method.
impl Assign<Constant> for Float
[src]
impl AssignRound<Constant> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn assign_round(&mut self, other: Constant, round: Round) -> Ordering
Assigns from a Constant
and applies the specified rounding
method.
impl Assign<Special> for Float
[src]
impl<'a> Assign<&'a Float> for Float
[src]
impl<'a> AssignRound<&'a Float> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn assign_round(&mut self, other: &'a Float, round: Round) -> Ordering
Assigns from
another Float
and applies the specified rounding method.
impl Assign<Float> for Float
[src]
impl AssignRound<Float> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn assign_round(&mut self, other: Float, round: Round) -> Ordering
Assigns from
another Float
and applies the specified rounding method.
impl<'a> Assign<&'a Integer> for Float
[src]
fn assign(&mut self, other: &'a Integer)
Assigns from
an Integer
and rounds to the nearest.
impl<'a> AssignRound<&'a Integer> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn assign_round(&mut self, other: &'a Integer, round: Round) -> Ordering
Assigns from
an Integer
and applies the specified rounding method.
impl Assign<Integer> for Float
[src]
fn assign(&mut self, other: Integer)
Assigns from
an Integer
and rounds to the nearest.
impl AssignRound<Integer> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn assign_round(&mut self, other: Integer, round: Round) -> Ordering
Assigns from
an Integer
and applies the specified rounding method.
impl<'a> Assign<&'a Rational> for Float
[src]
fn assign(&mut self, other: &'a Rational)
Assigns from
a Rational
number
and rounds to the nearest.
impl<'a> AssignRound<&'a Rational> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn assign_round(&mut self, other: &'a Rational, round: Round) -> Ordering
Assigns from
a Rational
number
and applies the specified rounding method.
impl Assign<Rational> for Float
[src]
fn assign(&mut self, other: Rational)
Assigns from
a Rational
number
and rounds to the nearest.
impl AssignRound<Rational> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn assign_round(&mut self, other: Rational, round: Round) -> Ordering
Assigns from
a Rational
number
and applies the specified rounding method.
impl<'a> Add<&'a Float> for Float
[src]
type Output = Float
The resulting type after applying the +
operator
fn add(self, op: &'a Float) -> Float
The method for the +
operator
impl Add<Float> for Float
[src]
type Output = Float
The resulting type after applying the +
operator
fn add(self, op: Float) -> Float
The method for the +
operator
impl<'a> AddRound<&'a Float> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the addition.
fn add_round(self, op: &'a Float, round: Round) -> (Float, Ordering)
Performs the addition.
impl AddRound<Float> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the addition.
fn add_round(self, op: Float, round: Round) -> (Float, Ordering)
Performs the addition.
impl<'a> AddAssign<&'a Float> for Float
[src]
fn add_assign(&mut self, op: &'a Float)
The method for the +=
operator
impl AddAssign<Float> for Float
[src]
fn add_assign(&mut self, op: Float)
The method for the +=
operator
impl<'a> Sub<&'a Float> for Float
[src]
type Output = Float
The resulting type after applying the -
operator
fn sub(self, op: &'a Float) -> Float
The method for the -
operator
impl Sub<Float> for Float
[src]
type Output = Float
The resulting type after applying the -
operator
fn sub(self, op: Float) -> Float
The method for the -
operator
impl<'a> SubRound<&'a Float> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the subtraction.
fn sub_round(self, op: &'a Float, round: Round) -> (Float, Ordering)
Performs the subtraction.
impl SubRound<Float> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the subtraction.
fn sub_round(self, op: Float, round: Round) -> (Float, Ordering)
Performs the subtraction.
impl<'a> SubAssign<&'a Float> for Float
[src]
fn sub_assign(&mut self, op: &'a Float)
The method for the -=
operator
impl SubAssign<Float> for Float
[src]
fn sub_assign(&mut self, op: Float)
The method for the -=
operator
impl SubFromAssign for Float
[src]
fn sub_from_assign(&mut self, lhs: Float)
Peforms the subtraction.
impl<'a> SubFromAssign<&'a Float> for Float
[src]
fn sub_from_assign(&mut self, lhs: &Float)
Peforms the subtraction.
impl<'a> Mul<&'a Float> for Float
[src]
type Output = Float
The resulting type after applying the *
operator
fn mul(self, op: &'a Float) -> Float
The method for the *
operator
impl Mul<Float> for Float
[src]
type Output = Float
The resulting type after applying the *
operator
fn mul(self, op: Float) -> Float
The method for the *
operator
impl<'a> MulRound<&'a Float> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the multiplication.
fn mul_round(self, op: &'a Float, round: Round) -> (Float, Ordering)
Performs the multiplication.
impl MulRound<Float> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the multiplication.
fn mul_round(self, op: Float, round: Round) -> (Float, Ordering)
Performs the multiplication.
impl<'a> MulAssign<&'a Float> for Float
[src]
fn mul_assign(&mut self, op: &'a Float)
The method for the *=
operator
impl MulAssign<Float> for Float
[src]
fn mul_assign(&mut self, op: Float)
The method for the *=
operator
impl<'a> Div<&'a Float> for Float
[src]
type Output = Float
The resulting type after applying the /
operator
fn div(self, op: &'a Float) -> Float
The method for the /
operator
impl Div<Float> for Float
[src]
type Output = Float
The resulting type after applying the /
operator
fn div(self, op: Float) -> Float
The method for the /
operator
impl<'a> DivRound<&'a Float> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the division.
fn div_round(self, op: &'a Float, round: Round) -> (Float, Ordering)
Performs the division.
impl DivRound<Float> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the division.
fn div_round(self, op: Float, round: Round) -> (Float, Ordering)
Performs the division.
impl<'a> DivAssign<&'a Float> for Float
[src]
fn div_assign(&mut self, op: &'a Float)
The method for the /=
operator
impl DivAssign<Float> for Float
[src]
fn div_assign(&mut self, op: Float)
The method for the /=
operator
impl DivFromAssign for Float
[src]
fn div_from_assign(&mut self, lhs: Float)
Peforms the division.
impl<'a> DivFromAssign<&'a Float> for Float
[src]
fn div_from_assign(&mut self, lhs: &Float)
Peforms the division.
impl<'a> Add<&'a Integer> for Float
[src]
type Output = Float
The resulting type after applying the +
operator
fn add(self, op: &'a Integer) -> Float
The method for the +
operator
impl Add<Integer> for Float
[src]
type Output = Float
The resulting type after applying the +
operator
fn add(self, op: Integer) -> Float
The method for the +
operator
impl<'a> AddRound<&'a Integer> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the addition.
fn add_round(self, op: &'a Integer, round: Round) -> (Float, Ordering)
Performs the addition.
impl AddRound<Integer> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the addition.
fn add_round(self, op: Integer, round: Round) -> (Float, Ordering)
Performs the addition.
impl<'a> AddAssign<&'a Integer> for Float
[src]
fn add_assign(&mut self, op: &'a Integer)
The method for the +=
operator
impl AddAssign<Integer> for Float
[src]
fn add_assign(&mut self, op: Integer)
The method for the +=
operator
impl<'a> Sub<&'a Integer> for Float
[src]
type Output = Float
The resulting type after applying the -
operator
fn sub(self, op: &'a Integer) -> Float
The method for the -
operator
impl Sub<Integer> for Float
[src]
type Output = Float
The resulting type after applying the -
operator
fn sub(self, op: Integer) -> Float
The method for the -
operator
impl<'a> SubRound<&'a Integer> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the subtraction.
fn sub_round(self, op: &'a Integer, round: Round) -> (Float, Ordering)
Performs the subtraction.
impl SubRound<Integer> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the subtraction.
fn sub_round(self, op: Integer, round: Round) -> (Float, Ordering)
Performs the subtraction.
impl<'a> SubAssign<&'a Integer> for Float
[src]
fn sub_assign(&mut self, op: &'a Integer)
The method for the -=
operator
impl SubAssign<Integer> for Float
[src]
fn sub_assign(&mut self, op: Integer)
The method for the -=
operator
impl SubFromAssign<Integer> for Float
[src]
fn sub_from_assign(&mut self, lhs: Integer)
Peforms the subtraction.
impl<'a> SubFromAssign<&'a Integer> for Float
[src]
fn sub_from_assign(&mut self, lhs: &Integer)
Peforms the subtraction.
impl<'a> Mul<&'a Integer> for Float
[src]
type Output = Float
The resulting type after applying the *
operator
fn mul(self, op: &'a Integer) -> Float
The method for the *
operator
impl Mul<Integer> for Float
[src]
type Output = Float
The resulting type after applying the *
operator
fn mul(self, op: Integer) -> Float
The method for the *
operator
impl<'a> MulRound<&'a Integer> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the multiplication.
fn mul_round(self, op: &'a Integer, round: Round) -> (Float, Ordering)
Performs the multiplication.
impl MulRound<Integer> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the multiplication.
fn mul_round(self, op: Integer, round: Round) -> (Float, Ordering)
Performs the multiplication.
impl<'a> MulAssign<&'a Integer> for Float
[src]
fn mul_assign(&mut self, op: &'a Integer)
The method for the *=
operator
impl MulAssign<Integer> for Float
[src]
fn mul_assign(&mut self, op: Integer)
The method for the *=
operator
impl<'a> Div<&'a Integer> for Float
[src]
type Output = Float
The resulting type after applying the /
operator
fn div(self, op: &'a Integer) -> Float
The method for the /
operator
impl Div<Integer> for Float
[src]
type Output = Float
The resulting type after applying the /
operator
fn div(self, op: Integer) -> Float
The method for the /
operator
impl<'a> DivRound<&'a Integer> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the division.
fn div_round(self, op: &'a Integer, round: Round) -> (Float, Ordering)
Performs the division.
impl DivRound<Integer> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the division.
fn div_round(self, op: Integer, round: Round) -> (Float, Ordering)
Performs the division.
impl<'a> DivAssign<&'a Integer> for Float
[src]
fn div_assign(&mut self, op: &'a Integer)
The method for the /=
operator
impl DivAssign<Integer> for Float
[src]
fn div_assign(&mut self, op: Integer)
The method for the /=
operator
impl<'a> Add<&'a Rational> for Float
[src]
type Output = Float
The resulting type after applying the +
operator
fn add(self, op: &'a Rational) -> Float
The method for the +
operator
impl Add<Rational> for Float
[src]
type Output = Float
The resulting type after applying the +
operator
fn add(self, op: Rational) -> Float
The method for the +
operator
impl<'a> AddRound<&'a Rational> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the addition.
fn add_round(self, op: &'a Rational, round: Round) -> (Float, Ordering)
Performs the addition.
impl AddRound<Rational> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the addition.
fn add_round(self, op: Rational, round: Round) -> (Float, Ordering)
Performs the addition.
impl<'a> AddAssign<&'a Rational> for Float
[src]
fn add_assign(&mut self, op: &'a Rational)
The method for the +=
operator
impl AddAssign<Rational> for Float
[src]
fn add_assign(&mut self, op: Rational)
The method for the +=
operator
impl<'a> Sub<&'a Rational> for Float
[src]
type Output = Float
The resulting type after applying the -
operator
fn sub(self, op: &'a Rational) -> Float
The method for the -
operator
impl Sub<Rational> for Float
[src]
type Output = Float
The resulting type after applying the -
operator
fn sub(self, op: Rational) -> Float
The method for the -
operator
impl<'a> SubRound<&'a Rational> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the subtraction.
fn sub_round(self, op: &'a Rational, round: Round) -> (Float, Ordering)
Performs the subtraction.
impl SubRound<Rational> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the subtraction.
fn sub_round(self, op: Rational, round: Round) -> (Float, Ordering)
Performs the subtraction.
impl<'a> SubAssign<&'a Rational> for Float
[src]
fn sub_assign(&mut self, op: &'a Rational)
The method for the -=
operator
impl SubAssign<Rational> for Float
[src]
fn sub_assign(&mut self, op: Rational)
The method for the -=
operator
impl<'a> Mul<&'a Rational> for Float
[src]
type Output = Float
The resulting type after applying the *
operator
fn mul(self, op: &'a Rational) -> Float
The method for the *
operator
impl Mul<Rational> for Float
[src]
type Output = Float
The resulting type after applying the *
operator
fn mul(self, op: Rational) -> Float
The method for the *
operator
impl<'a> MulRound<&'a Rational> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the multiplication.
fn mul_round(self, op: &'a Rational, round: Round) -> (Float, Ordering)
Performs the multiplication.
impl MulRound<Rational> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the multiplication.
fn mul_round(self, op: Rational, round: Round) -> (Float, Ordering)
Performs the multiplication.
impl<'a> MulAssign<&'a Rational> for Float
[src]
fn mul_assign(&mut self, op: &'a Rational)
The method for the *=
operator
impl MulAssign<Rational> for Float
[src]
fn mul_assign(&mut self, op: Rational)
The method for the *=
operator
impl<'a> Div<&'a Rational> for Float
[src]
type Output = Float
The resulting type after applying the /
operator
fn div(self, op: &'a Rational) -> Float
The method for the /
operator
impl Div<Rational> for Float
[src]
type Output = Float
The resulting type after applying the /
operator
fn div(self, op: Rational) -> Float
The method for the /
operator
impl<'a> DivRound<&'a Rational> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the division.
fn div_round(self, op: &'a Rational, round: Round) -> (Float, Ordering)
Performs the division.
impl DivRound<Rational> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the division.
fn div_round(self, op: Rational, round: Round) -> (Float, Ordering)
Performs the division.
impl<'a> DivAssign<&'a Rational> for Float
[src]
fn div_assign(&mut self, op: &'a Rational)
The method for the /=
operator
impl DivAssign<Rational> for Float
[src]
fn div_assign(&mut self, op: Rational)
The method for the /=
operator
impl Shl<u32> for Float
[src]
type Output = Float
The resulting type after applying the <<
operator
fn shl(self, op: u32) -> Float
Multiplies
self
by 2 to the power of op
, rounding to the
nearest.
impl ShlRound<u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the left shift operation.
fn shl_round(self, op: u32, round: Round) -> (Float, Ordering)
Multiplies
self
by 2 to the power of op
, applying the
specified rounding.
impl ShlAssign<u32> for Float
[src]
fn shl_assign(&mut self, op: u32)
Multiplies
self
by 2 to the power of op
, rounding to the
nearest.
impl Shr<u32> for Float
[src]
type Output = Float
The resulting type after applying the >>
operator
fn shr(self, op: u32) -> Float
Divides
self
by 2 to the power of op
, rounding to the
nearest.
impl ShrRound<u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the right shift operation.
fn shr_round(self, op: u32, round: Round) -> (Float, Ordering)
Divides
self
by 2 to the power of op
, applying the
specified rounding.
impl ShrAssign<u32> for Float
[src]
fn shr_assign(&mut self, op: u32)
Divides
self
by 2 to the power of op
, rounding to the
nearest.
impl Shl<i32> for Float
[src]
type Output = Float
The resulting type after applying the <<
operator
fn shl(self, op: i32) -> Float
Multiplies
self
by 2 to the power of op
, rounding to the
nearest.
impl ShlRound<i32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the left shift operation.
fn shl_round(self, op: i32, round: Round) -> (Float, Ordering)
Multiplies
self
by 2 to the power of op
, applying the
specified rounding.
impl ShlAssign<i32> for Float
[src]
fn shl_assign(&mut self, op: i32)
Multiplies
self
by 2 to the power of op
, rounding to the
nearest.
impl Shr<i32> for Float
[src]
type Output = Float
The resulting type after applying the >>
operator
fn shr(self, op: i32) -> Float
Divides
self
by 2 to the power of op
, rounding to the
nearest.
impl ShrRound<i32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the right shift operation.
fn shr_round(self, op: i32, round: Round) -> (Float, Ordering)
Divides
self
by 2 to the power of op
, applying the
specified rounding.
impl ShrAssign<i32> for Float
[src]
fn shr_assign(&mut self, op: i32)
Divides
self
by 2 to the power of op
, rounding to the
nearest.
impl<'a> PowRound<&'a Float> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the power operation.
fn pow_round(self, op: &'a Float, round: Round) -> (Float, Ordering)
Performs the power operation.
impl<'a> PowAssign<&'a Float> for Float
[src]
fn pow_assign(&mut self, op: &'a Float)
Peforms the power operation.
impl<'a> PowRound<&'a Integer> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the power operation.
fn pow_round(self, op: &'a Integer, round: Round) -> (Float, Ordering)
Performs the power operation.
impl<'a> PowAssign<&'a Integer> for Float
[src]
fn pow_assign(&mut self, op: &'a Integer)
Peforms the power operation.
impl<'a> Pow<&'a Float> for Float
[src]
type Output = Float
The resulting type after the power operation.
fn pow(self, op: &'a Float) -> Float
Performs the power operation.
impl Pow<Float> for Float
[src]
type Output = Float
The resulting type after the power operation.
fn pow(self, op: Float) -> Float
Performs the power operation.
impl PowRound<Float> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the power operation.
fn pow_round(self, op: Float, round: Round) -> (Float, Ordering)
Performs the power operation.
impl PowAssign<Float> for Float
[src]
fn pow_assign(&mut self, op: Float)
Peforms the power operation.
impl<'a> Pow<&'a Integer> for Float
[src]
type Output = Float
The resulting type after the power operation.
fn pow(self, op: &'a Integer) -> Float
Performs the power operation.
impl Pow<Integer> for Float
[src]
type Output = Float
The resulting type after the power operation.
fn pow(self, op: Integer) -> Float
Performs the power operation.
impl PowRound<Integer> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the power operation.
fn pow_round(self, op: Integer, round: Round) -> (Float, Ordering)
Performs the power operation.
impl PowAssign<Integer> for Float
[src]
fn pow_assign(&mut self, op: Integer)
Peforms the power operation.
impl Assign<u32> for Float
[src]
impl AssignRound<u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn assign_round(&mut self, val: u32, round: Round) -> Ordering
Peforms the assignment and rounding.
impl Add<u32> for Float
[src]
type Output = Float
The resulting type after applying the +
operator
fn add(self, op: u32) -> Float
The method for the +
operator
impl AddRound<u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the addition.
fn add_round(self, op: u32, round: Round) -> (Float, Ordering)
Performs the addition.
impl AddAssign<u32> for Float
[src]
fn add_assign(&mut self, op: u32)
The method for the +=
operator
impl Sub<u32> for Float
[src]
type Output = Float
The resulting type after applying the -
operator
fn sub(self, op: u32) -> Float
The method for the -
operator
impl SubRound<u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the subtraction.
fn sub_round(self, op: u32, round: Round) -> (Float, Ordering)
Performs the subtraction.
impl SubAssign<u32> for Float
[src]
fn sub_assign(&mut self, op: u32)
The method for the -=
operator
impl SubFromAssign<u32> for Float
[src]
fn sub_from_assign(&mut self, lhs: u32)
Peforms the subtraction.
impl Mul<u32> for Float
[src]
type Output = Float
The resulting type after applying the *
operator
fn mul(self, op: u32) -> Float
The method for the *
operator
impl MulRound<u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the multiplication.
fn mul_round(self, op: u32, round: Round) -> (Float, Ordering)
Performs the multiplication.
impl MulAssign<u32> for Float
[src]
fn mul_assign(&mut self, op: u32)
The method for the *=
operator
impl Div<u32> for Float
[src]
type Output = Float
The resulting type after applying the /
operator
fn div(self, op: u32) -> Float
The method for the /
operator
impl DivRound<u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the division.
fn div_round(self, op: u32, round: Round) -> (Float, Ordering)
Performs the division.
impl DivAssign<u32> for Float
[src]
fn div_assign(&mut self, op: u32)
The method for the /=
operator
impl DivFromAssign<u32> for Float
[src]
fn div_from_assign(&mut self, lhs: u32)
Peforms the division.
impl Assign<i32> for Float
[src]
impl AssignRound<i32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn assign_round(&mut self, val: i32, round: Round) -> Ordering
Peforms the assignment and rounding.
impl Add<i32> for Float
[src]
type Output = Float
The resulting type after applying the +
operator
fn add(self, op: i32) -> Float
The method for the +
operator
impl AddRound<i32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the addition.
fn add_round(self, op: i32, round: Round) -> (Float, Ordering)
Performs the addition.
impl AddAssign<i32> for Float
[src]
fn add_assign(&mut self, op: i32)
The method for the +=
operator
impl Sub<i32> for Float
[src]
type Output = Float
The resulting type after applying the -
operator
fn sub(self, op: i32) -> Float
The method for the -
operator
impl SubRound<i32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the subtraction.
fn sub_round(self, op: i32, round: Round) -> (Float, Ordering)
Performs the subtraction.
impl SubAssign<i32> for Float
[src]
fn sub_assign(&mut self, op: i32)
The method for the -=
operator
impl SubFromAssign<i32> for Float
[src]
fn sub_from_assign(&mut self, lhs: i32)
Peforms the subtraction.
impl Mul<i32> for Float
[src]
type Output = Float
The resulting type after applying the *
operator
fn mul(self, op: i32) -> Float
The method for the *
operator
impl MulRound<i32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the multiplication.
fn mul_round(self, op: i32, round: Round) -> (Float, Ordering)
Performs the multiplication.
impl MulAssign<i32> for Float
[src]
fn mul_assign(&mut self, op: i32)
The method for the *=
operator
impl Div<i32> for Float
[src]
type Output = Float
The resulting type after applying the /
operator
fn div(self, op: i32) -> Float
The method for the /
operator
impl DivRound<i32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the division.
fn div_round(self, op: i32, round: Round) -> (Float, Ordering)
Performs the division.
impl DivAssign<i32> for Float
[src]
fn div_assign(&mut self, op: i32)
The method for the /=
operator
impl DivFromAssign<i32> for Float
[src]
fn div_from_assign(&mut self, lhs: i32)
Peforms the division.
impl Assign<f64> for Float
[src]
impl AssignRound<f64> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn assign_round(&mut self, val: f64, round: Round) -> Ordering
Peforms the assignment and rounding.
impl Add<f64> for Float
[src]
type Output = Float
The resulting type after applying the +
operator
fn add(self, op: f64) -> Float
The method for the +
operator
impl AddRound<f64> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the addition.
fn add_round(self, op: f64, round: Round) -> (Float, Ordering)
Performs the addition.
impl AddAssign<f64> for Float
[src]
fn add_assign(&mut self, op: f64)
The method for the +=
operator
impl Sub<f64> for Float
[src]
type Output = Float
The resulting type after applying the -
operator
fn sub(self, op: f64) -> Float
The method for the -
operator
impl SubRound<f64> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the subtraction.
fn sub_round(self, op: f64, round: Round) -> (Float, Ordering)
Performs the subtraction.
impl SubAssign<f64> for Float
[src]
fn sub_assign(&mut self, op: f64)
The method for the -=
operator
impl SubFromAssign<f64> for Float
[src]
fn sub_from_assign(&mut self, lhs: f64)
Peforms the subtraction.
impl Mul<f64> for Float
[src]
type Output = Float
The resulting type after applying the *
operator
fn mul(self, op: f64) -> Float
The method for the *
operator
impl MulRound<f64> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the multiplication.
fn mul_round(self, op: f64, round: Round) -> (Float, Ordering)
Performs the multiplication.
impl MulAssign<f64> for Float
[src]
fn mul_assign(&mut self, op: f64)
The method for the *=
operator
impl Div<f64> for Float
[src]
type Output = Float
The resulting type after applying the /
operator
fn div(self, op: f64) -> Float
The method for the /
operator
impl DivRound<f64> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the division.
fn div_round(self, op: f64, round: Round) -> (Float, Ordering)
Performs the division.
impl DivAssign<f64> for Float
[src]
fn div_assign(&mut self, op: f64)
The method for the /=
operator
impl DivFromAssign<f64> for Float
[src]
fn div_from_assign(&mut self, lhs: f64)
Peforms the division.
impl Assign<f32> for Float
[src]
impl AssignRound<f32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
fn assign_round(&mut self, val: f32, round: Round) -> Ordering
Peforms the assignment and rounding.
impl Add<f32> for Float
[src]
type Output = Float
The resulting type after applying the +
operator
fn add(self, val: f32) -> Float
The method for the +
operator
impl AddRound<f32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the addition.
fn add_round(self, val: f32, round: Round) -> (Float, Ordering)
Performs the addition.
impl AddAssign<f32> for Float
[src]
fn add_assign(&mut self, val: f32)
The method for the +=
operator
impl Sub<f32> for Float
[src]
type Output = Float
The resulting type after applying the -
operator
fn sub(self, val: f32) -> Float
The method for the -
operator
impl SubRound<f32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the subtraction.
fn sub_round(self, val: f32, round: Round) -> (Float, Ordering)
Performs the subtraction.
impl SubAssign<f32> for Float
[src]
fn sub_assign(&mut self, val: f32)
The method for the -=
operator
impl Mul<f32> for Float
[src]
type Output = Float
The resulting type after applying the *
operator
fn mul(self, val: f32) -> Float
The method for the *
operator
impl MulRound<f32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the multiplication.
fn mul_round(self, val: f32, round: Round) -> (Float, Ordering)
Performs the multiplication.
impl MulAssign<f32> for Float
[src]
fn mul_assign(&mut self, val: f32)
The method for the *=
operator
impl Div<f32> for Float
[src]
type Output = Float
The resulting type after applying the /
operator
fn div(self, val: f32) -> Float
The method for the /
operator
impl DivRound<f32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the division.
fn div_round(self, val: f32, round: Round) -> (Float, Ordering)
Performs the division.
impl DivAssign<f32> for Float
[src]
fn div_assign(&mut self, val: f32)
The method for the /=
operator
impl Pow<u32> for Float
[src]
type Output = Float
The resulting type after the power operation.
fn pow(self, op: u32) -> Float
Performs the power operation.
impl PowRound<u32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the power operation.
fn pow_round(self, op: u32, round: Round) -> (Float, Ordering)
Performs the power operation.
impl PowAssign<u32> for Float
[src]
fn pow_assign(&mut self, op: u32)
Peforms the power operation.
impl Pow<i32> for Float
[src]
type Output = Float
The resulting type after the power operation.
fn pow(self, op: i32) -> Float
Performs the power operation.
impl PowRound<i32> for Float
[src]
type Round = Round
The rounding method.
type Ordering = Ordering
The direction from rounding.
type Output = Float
The resulting type after the power operation.
fn pow_round(self, op: i32, round: Round) -> (Float, Ordering)
Performs the power operation.
impl PowAssign<i32> for Float
[src]
fn pow_assign(&mut self, op: i32)
Peforms the power operation.
impl Neg for Float
[src]
type Output = Float
The resulting type after applying the -
operator
fn neg(self) -> Float
The method for the unary -
operator
impl NegAssign for Float
[src]
fn neg_assign(&mut self)
Peforms the negation.
impl PartialEq for Float
[src]
fn eq(&self, other: &Float) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl PartialOrd for Float
[src]
fn partial_cmp(&self, other: &Float) -> Option<Ordering>
Returns the ordering of self
and other
,
or None
if one (or both) of them is a NaN.
fn lt(&self, other: &Float) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Float) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Float) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Float) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialEq<Integer> for Float
[src]
fn eq(&self, other: &Integer) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl PartialOrd<Integer> for Float
[src]
fn partial_cmp(&self, other: &Integer) -> Option<Ordering>
Returns the ordering of self
and other
, or None
if self
is a NaN.
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialEq<Rational> for Float
[src]
fn eq(&self, other: &Rational) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl PartialOrd<Rational> for Float
[src]
fn partial_cmp(&self, other: &Rational) -> Option<Ordering>
Returns the ordering of self
and other
, or None
if self
is a NaN.
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialEq<u32> for Float
[src]
fn eq(&self, other: &u32) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl PartialOrd<u32> for Float
[src]
fn partial_cmp(&self, other: &u32) -> Option<Ordering>
Returns the ordering of self
and other
, or None
if self
is a NaN.
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialEq<i32> for Float
[src]
fn eq(&self, other: &i32) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl PartialOrd<i32> for Float
[src]
fn partial_cmp(&self, other: &i32) -> Option<Ordering>
Returns the ordering of self
and other
, or None
if self
is a NaN.
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialEq<f64> for Float
[src]
fn eq(&self, other: &f64) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl PartialOrd<f64> for Float
[src]
fn partial_cmp(&self, other: &f64) -> Option<Ordering>
Returns the ordering of self
and other
, or None
if one (or both) of them is a NaN.
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialEq<f32> for Float
[src]
fn eq(&self, other: &f32) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl PartialOrd<f32> for Float
[src]
fn partial_cmp(&self, other: &f32) -> Option<Ordering>
Returns the ordering of self
and other
, or None
if one (or both) of them is a NaN.
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more