docs

v0.1.2 문서를 보고 있습니다. 이 버전은 더 이상 지원하지 않습니다. 최신 릴리스: v0.1.3 →

core::num::bigfloat

이 페이지의 내용

API 참조는 영어로만 있습니다. 표준 라이브러리 소스의 영어 문서 주석에서 만듭니다.

float. #[keyword("float")] routes the type name here; an unsuffixed literal in a float slot is Float::from_f64, or Float::from_literal when f64 can't hold it.

A float has f64's 53-bit significand and an i64 exponent. In f64's normal range it is an f64 (e == 0) with IEEE 754 operations. A finite result outside that range is promoted to m * 2^e, 1 <= |m| < 2, rounded to nearest-even instead of becoming +/-inf / 0 / subnormal, so arithmetic never overflows; only / 0 and inf / NaN operands give inf / NaN.

Structs

FloatSource

pub struct Float

m * 2^e. e == 0: m is the value (zero, normal, inf or NaN, never subnormal). e != 0: 1 <= |m| < 2 and e is outside f64's normal exponents -1022..=1023.

  • pub const fn from_f64(x: f64) -> Float§

    Source

    The value x, exactly (subnormals, NaN and +/-inf included).

  • pub const fn from_f32(x: f32) -> Float§

    Source

    The value x, exactly.

  • pub const fn is_nan(self) -> bool§

    Source

    true for NaN.

  • pub const fn is_infinite(self) -> bool§

    Source

    true for inf or -inf.

  • pub const fn is_finite(self) -> bool§

    Source

    true unless infinite or NaN.

  • pub const fn is_zero(self) -> bool§

    Source

    true for 0.0 or -0.0.

  • pub const fn is_sign_negative(self) -> bool§

    Source

    true when the sign is negative (-0.0 too).

  • pub const fn abs(self) -> Float§

    Source

    The magnitude.

  • pub const fn to_f64(self) -> f64§

    Source

    The nearest f64: +/-inf past f64::MAX, ties to even into the subnormals, +/-0 below them.

  • pub const fn to_f32(self) -> f32 | none§

    Source

    none when a finite value is past f32's range; a finite value inside it rounds.

  • pub fn from_int(n: Int) -> Float§

    Source

    The nearest float to n (ties to even).

  • pub const fn to_int(self) -> Int | none§

    Source

    Truncated toward zero; none for NaN / +/-inf.

Trait implementations 19