Skip to main content

Float

Struct Float 

Source
pub struct Float(pub f64);

Tuple Fields§

§0: f64

Implementations§

Source§

impl Float

Source

pub fn to_tight_string(&self) -> String

Tight formatting of floats, where we emit them as integers when they do not have a decimal part used in e.g. the multido.sty binding and test

Trait Implementations§

Source§

impl Clone for Float

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Float

Source§

impl Debug for Float

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Float

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Float

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&str> for Float

Source§

fn from(spec: &str) -> Self

Non-numeric input silently becomes 0.0 (Perl parity — see the From<String> impl).

Source§

impl From<Float> for Tokens

Source§

fn from(v: Float) -> Tokens

Converts to this type from the input type.
Source§

impl From<Float> for Option<Tokens>

Source§

fn from(v: Float) -> Option<Tokens>

Converts to this type from the input type.
Source§

impl From<Float> for Stored

Source§

fn from(value: Float) -> Self

Converts to this type from the input type.
Source§

impl From<Float> for ArgWrap

Source§

fn from(t: Float) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Float

Source§

fn from(spec: String) -> Self

Parse a string into a Float. Non-numeric input silently becomes 0.0 to match Perl’s implicit numeric coercion — Float("abc") + x in Perl yields x, not a panic.

Source§

impl NumericOps for Float

Source§

fn new(number: i64) -> Self

Source§

fn new_f64(number: f64) -> Self

Source§

fn value_of(self) -> i64

Source§

fn value_f64(self) -> f64

Source§

fn negate(self) -> Self

Source§

fn register_type(&self) -> RegisterType

Source§

fn add<T: NumericOps>(self, other: T) -> Self

Source§

fn subtract<T: NumericOps>(self, other: T) -> Self

Source§

fn multiply<T: NumericOps>(self, other: T) -> Self

Source§

fn divide<T: NumericOps>(self, other: T) -> Self

Truncating division
Source§

fn unit(&self) -> Option<&'static str>

Source§

fn pt_value(self, prec: Option<u8>) -> f64
where Self: Sized,

Source§

fn px_value(self, prec: Option<u8>) -> f64
where Self: Sized,

Source§

fn absolute(self) -> Self
where Self: Sized,

Source§

fn sign(self) -> i8
where Self: Sized,

Source§

fn arith_ceiling() -> i64

The arith_error clamp bound: max_dimen for dimensions and glue, TeX’s integer infinity for counts (overridden by Number).
Source§

fn divideround<T: NumericOps>(self, other: T) -> Self
where Self: Sized,

Rounding division — eTeX’s quotient(n,d) (etex.ch “Declare subprocedures for scan_expr”): work on magnitudes and round half AWAY from zero, so \numexpr -1/2 = -1 and -7/2 = -4 (pdflatex-probed). Perl Number.pm int(0.5 + n/d) truncates toward zero and yields 0 / -3 (KNOWN_PERL_ERRORS #124); l3fp’s \__fp_mul_cases_o:NnNnww case index (#5 #2 #8) / 2 * 2 + 7 (expl3-code.tex:18724-18760) relies on the TeX rounding, so 0 * x inside a +/- expression collapsed the whole \fp_eval:n to 0 (wheelchart’s tikz transform determinant, wheelchart.sty:2423). A zero divisor is TeX’s arith_error → 0.
Source§

fn smaller<T: NumericOps>(self, other: T) -> Self
where Self: Sized,

Source§

fn larger<T: NumericOps>(self, other: T) -> Self
where Self: Sized,

Source§

fn to_token(self) -> Token
where Self: Sized,

Source§

fn into_glue_type(self) -> Glue
where Self: Sized,

Source§

fn to_attribute(&self) -> String
where Self: Display,

Source§

impl Object for Float

Source§

fn revert(&self) -> Result<Tokens>

each concrete object needs to provide its own path back to tokens
Source§

fn stringify(&self) -> String

Source§

fn be_digested(self) -> Result<Digested>

Source§

fn isa_box(&self) -> bool

Source§

fn is_expandable(&self) -> bool

Source§

fn is_definition(&self) -> bool

Source§

fn is_comment(&self) -> bool

Source§

fn get_locator(&self) -> Option<Locator>

The object’s stored source locator, if it has one. None is the honest “no recorded source position” (replacing the old Locator::default() file!()/line!() sentinel). For “where the parser is now” (error reporting, box creation), use the free fn gullet::get_locator().
Source§

fn get_origin(&self) -> DefinitionOrigin

Who made this definition (K1 provenance, definition::origin). The default is Unknown, which counts as LaTeXML’s own.
Source§

impl PartialEq for Float

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Float

Source§

impl TryFrom<ArgWrap> for Float

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(aw: ArgWrap) -> Result<Float>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Float

§

impl RefUnwindSafe for Float

§

impl Send for Float

§

impl Sync for Float

§

impl Unpin for Float

§

impl UnsafeUnpin for Float

§

impl UnwindSafe for Float

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoResultArgWrap<Result<ArgWrap, Error>> for T
where T: Into<ArgWrap>,

Source§

fn into_result_argwrap(self) -> Result<ArgWrap, Error>

performs the conversion
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.