pub struct ScientificNumber { /* private fields */ }Expand description
A Haystack scientific notation Number, encapsulating a value and an optional unit value. The unit is represented as a string.
Implementations§
Source§impl ScientificNumber
impl ScientificNumber
Sourcepub fn new(
significand: f64,
exponent: i32,
unit: Option<String>,
) -> Option<ScientificNumber>
pub fn new( significand: f64, exponent: i32, unit: Option<String>, ) -> Option<ScientificNumber>
Create a new ScientificNumber. If present, the unit should
be a valid unit string from Project Haystack’s
unit database. The significand must be a finite number which is
not NaN.
Sourcepub fn new_unitless(significand: f64, exponent: i32) -> Option<ScientificNumber>
pub fn new_unitless(significand: f64, exponent: i32) -> Option<ScientificNumber>
Create a new ScientificNumber with no unit. The significand must
be a finite number which is not NaN.
Sourcepub fn significand(&self) -> f64
pub fn significand(&self) -> f64
Return the numeric significand component of this number.
Sourcepub fn to_axon_code(&self) -> String
pub fn to_axon_code(&self) -> String
Return a string containing Axon code representing this number.
Trait Implementations§
Source§impl Clone for ScientificNumber
impl Clone for ScientificNumber
Source§fn clone(&self) -> ScientificNumber
fn clone(&self) -> ScientificNumber
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScientificNumber
impl Debug for ScientificNumber
Source§impl Display for ScientificNumber
impl Display for ScientificNumber
Source§impl PartialEq for ScientificNumber
impl PartialEq for ScientificNumber
impl StructuralPartialEq for ScientificNumber
Auto Trait Implementations§
impl Freeze for ScientificNumber
impl RefUnwindSafe for ScientificNumber
impl Send for ScientificNumber
impl Sync for ScientificNumber
impl Unpin for ScientificNumber
impl UnwindSafe for ScientificNumber
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more