pub struct DecimalNumber { /* private fields */ }
Expand description
Stores the integral/integer and fractional parts of a number written in decimal representation as strings.
For example: 3.14159265 has integral = ‘3’ and fractional = ‘14159265’
Implementations§
Source§impl DecimalNumber
impl DecimalNumber
pub fn new(text: &str) -> DecimalNumber
pub fn full_number(&self) -> String
Sourcepub fn sig_figs(&self) -> usize
pub fn sig_figs(&self) -> usize
Returns the number of significant figures of the DecimalNumber
Examples:
- “83.2” has 3 sig figs
- “0.032” has 2 sig figs(note the preceding zeroes)
- “788” has 3 sig figs
- “78800” also has 3 sig figs(note the trailing zeroes)
- “78801” has 5 sig figs
pub fn as_float(&self) -> f64
Trait Implementations§
Source§impl Clone for DecimalNumber
impl Clone for DecimalNumber
Source§fn clone(&self) -> DecimalNumber
fn clone(&self) -> DecimalNumber
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 DecimalNumber
impl Debug for DecimalNumber
Source§impl Display for DecimalNumber
impl Display for DecimalNumber
Source§impl PartialEq for DecimalNumber
impl PartialEq for DecimalNumber
impl StructuralPartialEq for DecimalNumber
Auto Trait Implementations§
impl Freeze for DecimalNumber
impl RefUnwindSafe for DecimalNumber
impl Send for DecimalNumber
impl Sync for DecimalNumber
impl Unpin for DecimalNumber
impl UnwindSafe for DecimalNumber
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