Trait malachite_base::num::conversion::traits::ToSci
source · [−]pub trait ToSci: Sized {
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result;
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool;
fn to_sci_with_options(&self, options: ToSciOptions) -> SciWrapper<'_, Self> { ... }
fn to_sci(&self) -> SciWrapper<'_, Self> { ... }
}
Expand description
Converts a number to a string, possibly in scientific notation.
Required Methods
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
Formats a number, possibly in scientific notation.
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
Determines whether some formatting options can be applied to a number.
Provided Methods
fn to_sci_with_options(&self, options: ToSciOptions) -> SciWrapper<'_, Self>
fn to_sci_with_options(&self, options: ToSciOptions) -> SciWrapper<'_, Self>
Converts a number to a string, possibly in scientific notation.
fn to_sci(&self) -> SciWrapper<'_, Self>
fn to_sci(&self) -> SciWrapper<'_, Self>
Converts a number to a string, possibly in scientific notation, using the default
ToSciOptions
.
Implementations on Foreign Types
sourceimpl ToSci for u8
impl ToSci for u8
sourcefn fmt_sci_valid(&self, options: ToSciOptions) -> bool
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
Determines whether an unsigned number can be converted to a string using
to_sci_with_options
and a
particular set of options.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourcefn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
Converts an unsigned number to a string using a specified base, possibly formatting the number using scientific notation.
See ToSciOptions
for details on the available
options. Note that setting neg_exp_threshold
has no effect, since there is never
a need to use negative exponents when representing an integer.
Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits()
.
Panics
Panics if options.rounding_mode
is Exact
, but the size options are such that
the input must be rounded.
Examples
See here.
sourceimpl ToSci for u16
impl ToSci for u16
sourcefn fmt_sci_valid(&self, options: ToSciOptions) -> bool
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
Determines whether an unsigned number can be converted to a string using
to_sci_with_options
and a
particular set of options.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourcefn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
Converts an unsigned number to a string using a specified base, possibly formatting the number using scientific notation.
See ToSciOptions
for details on the available
options. Note that setting neg_exp_threshold
has no effect, since there is never
a need to use negative exponents when representing an integer.
Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits()
.
Panics
Panics if options.rounding_mode
is Exact
, but the size options are such that
the input must be rounded.
Examples
See here.
sourceimpl ToSci for u32
impl ToSci for u32
sourcefn fmt_sci_valid(&self, options: ToSciOptions) -> bool
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
Determines whether an unsigned number can be converted to a string using
to_sci_with_options
and a
particular set of options.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourcefn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
Converts an unsigned number to a string using a specified base, possibly formatting the number using scientific notation.
See ToSciOptions
for details on the available
options. Note that setting neg_exp_threshold
has no effect, since there is never
a need to use negative exponents when representing an integer.
Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits()
.
Panics
Panics if options.rounding_mode
is Exact
, but the size options are such that
the input must be rounded.
Examples
See here.
sourceimpl ToSci for u64
impl ToSci for u64
sourcefn fmt_sci_valid(&self, options: ToSciOptions) -> bool
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
Determines whether an unsigned number can be converted to a string using
to_sci_with_options
and a
particular set of options.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourcefn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
Converts an unsigned number to a string using a specified base, possibly formatting the number using scientific notation.
See ToSciOptions
for details on the available
options. Note that setting neg_exp_threshold
has no effect, since there is never
a need to use negative exponents when representing an integer.
Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits()
.
Panics
Panics if options.rounding_mode
is Exact
, but the size options are such that
the input must be rounded.
Examples
See here.
sourceimpl ToSci for u128
impl ToSci for u128
sourcefn fmt_sci_valid(&self, options: ToSciOptions) -> bool
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
Determines whether an unsigned number can be converted to a string using
to_sci_with_options
and a
particular set of options.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourcefn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
Converts an unsigned number to a string using a specified base, possibly formatting the number using scientific notation.
See ToSciOptions
for details on the available
options. Note that setting neg_exp_threshold
has no effect, since there is never
a need to use negative exponents when representing an integer.
Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits()
.
Panics
Panics if options.rounding_mode
is Exact
, but the size options are such that
the input must be rounded.
Examples
See here.
sourceimpl ToSci for usize
impl ToSci for usize
sourcefn fmt_sci_valid(&self, options: ToSciOptions) -> bool
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
Determines whether an unsigned number can be converted to a string using
to_sci_with_options
and a
particular set of options.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourcefn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
Converts an unsigned number to a string using a specified base, possibly formatting the number using scientific notation.
See ToSciOptions
for details on the available
options. Note that setting neg_exp_threshold
has no effect, since there is never
a need to use negative exponents when representing an integer.
Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits()
.
Panics
Panics if options.rounding_mode
is Exact
, but the size options are such that
the input must be rounded.
Examples
See here.
sourceimpl ToSci for i8
impl ToSci for i8
sourcefn fmt_sci_valid(&self, options: ToSciOptions) -> bool
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
Determines whether a signed number can be converted to a string using
to_sci_with_options
and a
particular set of options.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourcefn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
Converts a signed number to a string using a specified base, possibly formatting the number using scientific notation.
See ToSciOptions
for details on the available
options. Note that setting neg_exp_threshold
has no effect, since there is never
a need to use negative exponents when representing an integer.
Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits()
.
Panics
Panics if options.rounding_mode
is Exact
, but the size options are such that
the input must be rounded.
Examples
See here.
sourceimpl ToSci for i16
impl ToSci for i16
sourcefn fmt_sci_valid(&self, options: ToSciOptions) -> bool
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
Determines whether a signed number can be converted to a string using
to_sci_with_options
and a
particular set of options.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourcefn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
Converts a signed number to a string using a specified base, possibly formatting the number using scientific notation.
See ToSciOptions
for details on the available
options. Note that setting neg_exp_threshold
has no effect, since there is never
a need to use negative exponents when representing an integer.
Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits()
.
Panics
Panics if options.rounding_mode
is Exact
, but the size options are such that
the input must be rounded.
Examples
See here.
sourceimpl ToSci for i32
impl ToSci for i32
sourcefn fmt_sci_valid(&self, options: ToSciOptions) -> bool
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
Determines whether a signed number can be converted to a string using
to_sci_with_options
and a
particular set of options.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourcefn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
Converts a signed number to a string using a specified base, possibly formatting the number using scientific notation.
See ToSciOptions
for details on the available
options. Note that setting neg_exp_threshold
has no effect, since there is never
a need to use negative exponents when representing an integer.
Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits()
.
Panics
Panics if options.rounding_mode
is Exact
, but the size options are such that
the input must be rounded.
Examples
See here.
sourceimpl ToSci for i64
impl ToSci for i64
sourcefn fmt_sci_valid(&self, options: ToSciOptions) -> bool
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
Determines whether a signed number can be converted to a string using
to_sci_with_options
and a
particular set of options.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourcefn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
Converts a signed number to a string using a specified base, possibly formatting the number using scientific notation.
See ToSciOptions
for details on the available
options. Note that setting neg_exp_threshold
has no effect, since there is never
a need to use negative exponents when representing an integer.
Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits()
.
Panics
Panics if options.rounding_mode
is Exact
, but the size options are such that
the input must be rounded.
Examples
See here.
sourceimpl ToSci for i128
impl ToSci for i128
sourcefn fmt_sci_valid(&self, options: ToSciOptions) -> bool
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
Determines whether a signed number can be converted to a string using
to_sci_with_options
and a
particular set of options.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourcefn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
Converts a signed number to a string using a specified base, possibly formatting the number using scientific notation.
See ToSciOptions
for details on the available
options. Note that setting neg_exp_threshold
has no effect, since there is never
a need to use negative exponents when representing an integer.
Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits()
.
Panics
Panics if options.rounding_mode
is Exact
, but the size options are such that
the input must be rounded.
Examples
See here.
sourceimpl ToSci for isize
impl ToSci for isize
sourcefn fmt_sci_valid(&self, options: ToSciOptions) -> bool
fn fmt_sci_valid(&self, options: ToSciOptions) -> bool
Determines whether a signed number can be converted to a string using
to_sci_with_options
and a
particular set of options.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourcefn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
fn fmt_sci(&self, f: &mut Formatter<'_>, options: ToSciOptions) -> Result
Converts a signed number to a string using a specified base, possibly formatting the number using scientific notation.
See ToSciOptions
for details on the available
options. Note that setting neg_exp_threshold
has no effect, since there is never
a need to use negative exponents when representing an integer.
Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits()
.
Panics
Panics if options.rounding_mode
is Exact
, but the size options are such that
the input must be rounded.
Examples
See here.