Type Alias serde::lib::core::ffi::c_double

1.64.0 · source ·
pub type c_double = f64;
Expand description

Equivalent to C’s double type.

This type will almost always be f64, which is guaranteed to be an IEEE 754 double-precision float in Rust. That said, the standard technically only guarantees that it be a floating-point number with at least the precision of a float, and it may be f32 or something entirely different from the IEEE-754 standard.

Trait Implementations§

1.0.0 · source§

impl Add<&f64> for f64

§

type Output = <f64 as Add<f64>>::Output

The resulting type after applying the + operator.
source§

fn add(self, other: &f64) -> <f64 as Add<f64>>::Output

Performs the + operation. Read more
1.0.0 · source§

impl Add<f64> for f64

§

type Output = f64

The resulting type after applying the + operator.
source§

fn add(self, other: f64) -> f64

Performs the + operation. Read more
1.22.0 · source§

impl AddAssign<&f64> for f64

source§

fn add_assign(&mut self, other: &f64)

Performs the += operation. Read more
1.8.0 · source§

impl AddAssign<f64> for f64

source§

fn add_assign(&mut self, other: f64)

Performs the += operation. Read more
1.0.0 · source§

impl Clone for f64

source§

fn clone(&self) -> f64

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
1.0.0 · source§

impl Debug for f64

source§

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

Formats the value using the given formatter. Read more
1.0.0 · source§

impl Default for f64

source§

fn default() -> f64

Returns the default value of 0.0

source§

impl<'de> Deserialize<'de> for f64

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
1.0.0 · source§

impl Display for f64

source§

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

Formats the value using the given formatter. Read more
1.0.0 · source§

impl Div<&f64> for f64

§

type Output = <f64 as Div<f64>>::Output

The resulting type after applying the / operator.
source§

fn div(self, other: &f64) -> <f64 as Div<f64>>::Output

Performs the / operation. Read more
1.0.0 · source§

impl Div<f64> for f64

§

type Output = f64

The resulting type after applying the / operator.
source§

fn div(self, other: f64) -> f64

Performs the / operation. Read more
1.22.0 · source§

impl DivAssign<&f64> for f64

source§

fn div_assign(&mut self, other: &f64)

Performs the /= operation. Read more
1.8.0 · source§

impl DivAssign<f64> for f64

source§

fn div_assign(&mut self, other: f64)

Performs the /= operation. Read more
1.68.0 · source§

impl From<bool> for f64

source§

fn from(small: bool) -> f64

Converts bool to f64 losslessly. The resulting value is positive 0.0 for false and 1.0 for true values.

Examples
let x: f64 = false.into();
assert_eq!(x, 0.0);
assert!(x.is_sign_positive());

let y: f64 = true.into();
assert_eq!(y, 1.0);
1.6.0 · source§

impl From<f32> for f64

source§

fn from(small: f32) -> f64

Converts f32 to f64 losslessly.

1.6.0 · source§

impl From<i16> for f64

source§

fn from(small: i16) -> f64

Converts i16 to f64 losslessly.

1.6.0 · source§

impl From<i32> for f64

source§

fn from(small: i32) -> f64

Converts i32 to f64 losslessly.

1.6.0 · source§

impl From<i8> for f64

source§

fn from(small: i8) -> f64

Converts i8 to f64 losslessly.

1.6.0 · source§

impl From<u16> for f64

source§

fn from(small: u16) -> f64

Converts u16 to f64 losslessly.

1.6.0 · source§

impl From<u32> for f64

source§

fn from(small: u32) -> f64

Converts u32 to f64 losslessly.

1.6.0 · source§

impl From<u8> for f64

source§

fn from(small: u8) -> f64

Converts u8 to f64 losslessly.

1.0.0 · source§

impl FromStr for f64

source§

fn from_str(src: &str) -> Result<f64, ParseFloatError>

Converts a string in base 10 to a float. Accepts an optional decimal exponent.

This function accepts strings such as

  • ‘3.14’
  • ‘-3.14’
  • ‘2.5E10’, or equivalently, ‘2.5e10’
  • ‘2.5E-10’
  • ‘5.’
  • ‘.5’, or, equivalently, ‘0.5’
  • ‘inf’, ‘-inf’, ‘+infinity’, ‘NaN’

Note that alphabetical characters are not case-sensitive.

Leading and trailing whitespace represent an error.

Grammar

All strings that adhere to the following EBNF grammar when lowercased will result in an Ok being returned:

Float  ::= Sign? ( 'inf' | 'infinity' | 'nan' | Number )
Number ::= ( Digit+ |
             Digit+ '.' Digit* |
             Digit* '.' Digit+ ) Exp?
Exp    ::= 'e' Sign? Digit+
Sign   ::= [+-]
Digit  ::= [0-9]
Arguments
  • src - A string
Return value

Err(ParseFloatError) if the string did not represent a valid number. Otherwise, Ok(n) where n is the closest representable floating-point number to the number represented by src (following the same rules for rounding as for the results of primitive operations).

§

type Err = ParseFloatError

The associated error which can be returned from parsing.
source§

impl<'de, E> IntoDeserializer<'de, E> for f64where E: Error,

§

type Deserializer = F64Deserializer<E>

The type of the deserializer being converted into.
source§

fn into_deserializer(self) -> F64Deserializer<E>

Convert this value into a deserializer.
1.0.0 · source§

impl LowerExp for f64

source§

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

Formats the value using the given formatter.
1.0.0 · source§

impl Mul<&f64> for f64

§

type Output = <f64 as Mul<f64>>::Output

The resulting type after applying the * operator.
source§

fn mul(self, other: &f64) -> <f64 as Mul<f64>>::Output

Performs the * operation. Read more
1.0.0 · source§

impl Mul<f64> for f64

§

type Output = f64

The resulting type after applying the * operator.
source§

fn mul(self, other: f64) -> f64

Performs the * operation. Read more
1.22.0 · source§

impl MulAssign<&f64> for f64

source§

fn mul_assign(&mut self, other: &f64)

Performs the *= operation. Read more
1.8.0 · source§

impl MulAssign<f64> for f64

source§

fn mul_assign(&mut self, other: f64)

Performs the *= operation. Read more
1.0.0 · source§

impl Neg for f64

§

type Output = f64

The resulting type after applying the - operator.
source§

fn neg(self) -> f64

Performs the unary - operation. Read more
1.0.0 · source§

impl PartialEq<f64> for f64

source§

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

This method tests for self and other values to be equal, and is used by ==.
source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
1.0.0 · source§

impl PartialOrd<f64> for f64

source§

fn partial_cmp(&self, other: &f64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
source§

fn lt(&self, other: &f64) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
source§

fn le(&self, other: &f64) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
source§

fn ge(&self, other: &f64) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

fn gt(&self, other: &f64) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.12.0 · source§

impl<'a> Product<&'a f64> for f64

source§

fn product<I>(iter: I) -> f64where I: Iterator<Item = &'a f64>,

Method which takes an iterator and generates Self from the elements by multiplying the items.
1.12.0 · source§

impl Product<f64> for f64

source§

fn product<I>(iter: I) -> f64where I: Iterator<Item = f64>,

Method which takes an iterator and generates Self from the elements by multiplying the items.
1.0.0 · source§

impl Rem<&f64> for f64

§

type Output = <f64 as Rem<f64>>::Output

The resulting type after applying the % operator.
source§

fn rem(self, other: &f64) -> <f64 as Rem<f64>>::Output

Performs the % operation. Read more
1.0.0 · source§

impl Rem<f64> for f64

The remainder from the division of two floats.

The remainder has the same sign as the dividend and is computed as: x - (x / y).trunc() * y.

Examples

let x: f32 = 50.50;
let y: f32 = 8.125;
let remainder = x - (x / y).trunc() * y;

// The answer to both operations is 1.75
assert_eq!(x % y, remainder);
§

type Output = f64

The resulting type after applying the % operator.
source§

fn rem(self, other: f64) -> f64

Performs the % operation. Read more
1.22.0 · source§

impl RemAssign<&f64> for f64

source§

fn rem_assign(&mut self, other: &f64)

Performs the %= operation. Read more
1.8.0 · source§

impl RemAssign<f64> for f64

source§

fn rem_assign(&mut self, other: f64)

Performs the %= operation. Read more
source§

impl Serialize for f64

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl SimdElement for f64

§

type Mask = i64

🔬This is a nightly-only experimental API. (portable_simd)
The mask element type corresponding to this element type.
1.0.0 · source§

impl Sub<&f64> for f64

§

type Output = <f64 as Sub<f64>>::Output

The resulting type after applying the - operator.
source§

fn sub(self, other: &f64) -> <f64 as Sub<f64>>::Output

Performs the - operation. Read more
1.0.0 · source§

impl Sub<f64> for f64

§

type Output = f64

The resulting type after applying the - operator.
source§

fn sub(self, other: f64) -> f64

Performs the - operation. Read more
1.22.0 · source§

impl SubAssign<&f64> for f64

source§

fn sub_assign(&mut self, other: &f64)

Performs the -= operation. Read more
1.8.0 · source§

impl SubAssign<f64> for f64

source§

fn sub_assign(&mut self, other: f64)

Performs the -= operation. Read more
1.12.0 · source§

impl<'a> Sum<&'a f64> for f64

source§

fn sum<I>(iter: I) -> f64where I: Iterator<Item = &'a f64>,

Method which takes an iterator and generates Self from the elements by “summing up” the items.
1.12.0 · source§

impl Sum<f64> for f64

source§

fn sum<I>(iter: I) -> f64where I: Iterator<Item = f64>,

Method which takes an iterator and generates Self from the elements by “summing up” the items.
1.0.0 · source§

impl UpperExp for f64

source§

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

Formats the value using the given formatter.
1.0.0 · source§

impl Copy for f64

source§

impl FloatToInt<i128> for f64

source§

impl FloatToInt<i16> for f64

source§

impl FloatToInt<i32> for f64

source§

impl FloatToInt<i64> for f64

source§

impl FloatToInt<i8> for f64

source§

impl FloatToInt<isize> for f64

source§

impl FloatToInt<u128> for f64

source§

impl FloatToInt<u16> for f64

source§

impl FloatToInt<u32> for f64

source§

impl FloatToInt<u64> for f64

source§

impl FloatToInt<u8> for f64

source§

impl FloatToInt<usize> for f64

source§

impl SimdCast for f64