pub struct FixedFloat { /* private fields */ }Expand description
A floating-point value carrying a fixed working precision and rounding mode.
Implementations§
Source§impl FixedFloat
impl FixedFloat
Sourcepub fn from_float(value: Float, mode: RoundingMode) -> FixedFloat
pub fn from_float(value: Float, mode: RoundingMode) -> FixedFloat
Wraps a Float, adopting its precision and the given rounding mode.
Sourcepub fn from_int(n: &Int, precision: u64, mode: RoundingMode) -> FixedFloat
pub fn from_int(n: &Int, precision: u64, mode: RoundingMode) -> FixedFloat
Builds from an integer at precision bits.
Sourcepub fn from_f64(x: f64, precision: u64, mode: RoundingMode) -> FixedFloat
pub fn from_f64(x: f64, precision: u64, mode: RoundingMode) -> FixedFloat
Builds from an f64 at precision bits.
Sourcepub fn zero(precision: u64, mode: RoundingMode) -> FixedFloat
pub fn zero(precision: u64, mode: RoundingMode) -> FixedFloat
Positive zero at precision bits.
Sourcepub fn nan(precision: u64, mode: RoundingMode) -> FixedFloat
pub fn nan(precision: u64, mode: RoundingMode) -> FixedFloat
NaN / ±∞ at precision bits.
Sourcepub fn infinity(precision: u64, mode: RoundingMode) -> FixedFloat
pub fn infinity(precision: u64, mode: RoundingMode) -> FixedFloat
Positive infinity at precision bits.
Sourcepub fn neg_infinity(precision: u64, mode: RoundingMode) -> FixedFloat
pub fn neg_infinity(precision: u64, mode: RoundingMode) -> FixedFloat
Negative infinity at precision bits.
Sourcepub fn pi(precision: u64, mode: RoundingMode) -> FixedFloat
pub fn pi(precision: u64, mode: RoundingMode) -> FixedFloat
π at precision bits.
Sourcepub fn e(precision: u64, mode: RoundingMode) -> FixedFloat
pub fn e(precision: u64, mode: RoundingMode) -> FixedFloat
Euler’s number e at precision bits.
Sourcepub fn rounding_mode(&self) -> RoundingMode
pub fn rounding_mode(&self) -> RoundingMode
Returns the rounding mode.
Sourcepub fn into_float(self) -> Float
pub fn into_float(self) -> Float
Consumes into the underlying Float.
Sourcepub fn to_shortest_string(&self) -> String
pub fn to_shortest_string(&self) -> String
Returns the shortest round-tripping decimal string.
Sourcepub fn is_infinite(&self) -> bool
pub fn is_infinite(&self) -> bool
Returns true if this value is ±∞.
Sourcepub fn with_precision(&self, precision: u64) -> FixedFloat
pub fn with_precision(&self, precision: u64) -> FixedFloat
Re-rounds to a different precision (keeping the rounding mode).
Sourcepub fn neg(&self) -> FixedFloat
pub fn neg(&self) -> FixedFloat
Returns -self.
Sourcepub fn abs(&self) -> FixedFloat
pub fn abs(&self) -> FixedFloat
Returns |self|.
Sourcepub fn sqrt(&self) -> FixedFloat
pub fn sqrt(&self) -> FixedFloat
Returns √self.
Sourcepub fn exp(&self) -> FixedFloat
pub fn exp(&self) -> FixedFloat
Returns e^self.
Sourcepub fn ln(&self) -> FixedFloat
pub fn ln(&self) -> FixedFloat
Returns ln(self).
Sourcepub fn sin(&self) -> FixedFloat
pub fn sin(&self) -> FixedFloat
Returns sin(self).
Sourcepub fn cos(&self) -> FixedFloat
pub fn cos(&self) -> FixedFloat
Returns cos(self).
Sourcepub fn tan(&self) -> FixedFloat
pub fn tan(&self) -> FixedFloat
Returns tan(self).
Sourcepub fn atan(&self) -> FixedFloat
pub fn atan(&self) -> FixedFloat
Returns atan(self).
Sourcepub fn pow(&self, exp: &FixedFloat) -> FixedFloat
pub fn pow(&self, exp: &FixedFloat) -> FixedFloat
Returns self raised to the floating power exp.
Trait Implementations§
Source§impl Add for FixedFloat
impl Add for FixedFloat
Source§type Output = FixedFloat
type Output = FixedFloat
+ operator.Source§fn add(self, rhs: FixedFloat) -> FixedFloat
fn add(self, rhs: FixedFloat) -> FixedFloat
+ operation. Read moreSource§impl Add<&FixedFloat> for &FixedFloat
impl Add<&FixedFloat> for &FixedFloat
Source§type Output = FixedFloat
type Output = FixedFloat
+ operator.Source§fn add(self, rhs: &FixedFloat) -> FixedFloat
fn add(self, rhs: &FixedFloat) -> FixedFloat
+ operation. Read moreSource§impl AddAssign for FixedFloat
impl AddAssign for FixedFloat
Source§fn add_assign(&mut self, rhs: FixedFloat)
fn add_assign(&mut self, rhs: FixedFloat)
+= operation. Read moreSource§impl Clone for FixedFloat
impl Clone for FixedFloat
Source§fn clone(&self) -> FixedFloat
fn clone(&self) -> FixedFloat
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FixedFloat
impl Debug for FixedFloat
Source§impl Display for FixedFloat
impl Display for FixedFloat
Source§impl Div for FixedFloat
impl Div for FixedFloat
Source§type Output = FixedFloat
type Output = FixedFloat
/ operator.Source§fn div(self, rhs: FixedFloat) -> FixedFloat
fn div(self, rhs: FixedFloat) -> FixedFloat
/ operation. Read moreSource§impl Div<&FixedFloat> for &FixedFloat
impl Div<&FixedFloat> for &FixedFloat
Source§type Output = FixedFloat
type Output = FixedFloat
/ operator.Source§fn div(self, rhs: &FixedFloat) -> FixedFloat
fn div(self, rhs: &FixedFloat) -> FixedFloat
/ operation. Read moreSource§impl DivAssign for FixedFloat
impl DivAssign for FixedFloat
Source§fn div_assign(&mut self, rhs: FixedFloat)
fn div_assign(&mut self, rhs: FixedFloat)
/= operation. Read moreSource§impl Mul for FixedFloat
impl Mul for FixedFloat
Source§type Output = FixedFloat
type Output = FixedFloat
* operator.Source§fn mul(self, rhs: FixedFloat) -> FixedFloat
fn mul(self, rhs: FixedFloat) -> FixedFloat
* operation. Read moreSource§impl Mul<&FixedFloat> for &FixedFloat
impl Mul<&FixedFloat> for &FixedFloat
Source§type Output = FixedFloat
type Output = FixedFloat
* operator.Source§fn mul(self, rhs: &FixedFloat) -> FixedFloat
fn mul(self, rhs: &FixedFloat) -> FixedFloat
* operation. Read moreSource§impl MulAssign for FixedFloat
impl MulAssign for FixedFloat
Source§fn mul_assign(&mut self, rhs: FixedFloat)
fn mul_assign(&mut self, rhs: FixedFloat)
*= operation. Read moreSource§impl Neg for FixedFloat
impl Neg for FixedFloat
Source§type Output = FixedFloat
type Output = FixedFloat
- operator.Source§fn neg(self) -> FixedFloat
fn neg(self) -> FixedFloat
- operation. Read moreSource§impl PartialEq for FixedFloat
impl PartialEq for FixedFloat
Source§impl PartialOrd for FixedFloat
impl PartialOrd for FixedFloat
Source§impl Sub for FixedFloat
impl Sub for FixedFloat
Source§type Output = FixedFloat
type Output = FixedFloat
- operator.Source§fn sub(self, rhs: FixedFloat) -> FixedFloat
fn sub(self, rhs: FixedFloat) -> FixedFloat
- operation. Read moreSource§impl Sub<&FixedFloat> for &FixedFloat
impl Sub<&FixedFloat> for &FixedFloat
Source§type Output = FixedFloat
type Output = FixedFloat
- operator.Source§fn sub(self, rhs: &FixedFloat) -> FixedFloat
fn sub(self, rhs: &FixedFloat) -> FixedFloat
- operation. Read moreSource§impl SubAssign for FixedFloat
impl SubAssign for FixedFloat
Source§fn sub_assign(&mut self, rhs: FixedFloat)
fn sub_assign(&mut self, rhs: FixedFloat)
-= operation. Read more