Float128 structv0.1.0

Source
An IEEE binary128 value, held as its bits.
pub struct Float128 {
    // private fields
}

Associated functions

FromBits

pub func FromBits(bits: uint128) -> Float128

The value these bits encode.

NameTypeDescription
bitsuint128the value's bit pattern

Returns: the value that bit pattern stands for

Source

FromValue

pub func FromValue(value: float128) -> Float128

The value a float128 holds, carried as its bits. Reads the primitive's storage through a raw pointer, as BitsOfFloat64 does: a cast would ask for the number, and what is wanted is its representation.

NameTypeDescription
valuefloat128the primitive to read

Returns: the value with that primitive's bit pattern

Source

Layout

pub func Layout() -> FloatLayout

The format these bits are read under.

Returns: which format the bits are in

Source

Methods

Value

pub func Value(self: &Float128) -> float128

The float128 these bits encode, for arithmetic on a value that was read or built here. Writes the bits into the primitive's storage through a raw pointer.

Returns: the primitive with this value's bit pattern

Source

Bits

pub func Bits(self: &Float128) -> uint128

The bits.

Returns: the value's bit pattern

Source

IsNan

pub func IsNan(self: &Float128) -> bool

Whether this is not a number.

Returns: whether the value is a NaN

Source

IsInfinite

pub func IsInfinite(self: &Float128) -> bool

Whether this is an infinity of either sign.

Returns: whether the value is either infinity

Source

IsFinite

pub func IsFinite(self: &Float128) -> bool

Whether this is an ordinary value: neither a NaN nor an infinity.

Returns: whether the value is neither infinite nor a NaN

Source

IsNegative

pub func IsNegative(self: &Float128) -> bool

Whether the sign bit is set, which a negative zero answers yes to.

Returns: whether the sign bit is set

Source

FormatWith

pub func FormatWith(
    self: &Float128,
    allocator: Allocator,
    writer: &var TextWriter,
    spec: FormatSpec
) -> ! FormatError

Writes this value's text under spec, taking the working storage from allocator. The shortest decimal that reads back as the same bits, or the digits a precision asks for. This is the only way to render one of these: they implement neither Display nor Debug, because the exact arithmetic their text needs allocates and those protocols offer nowhere to say from where. Reports whatever the writer reported, UnsupportedRequest for any style, and TextFailure(OutOfMemory) where allocator could not supply the working storage.

NameTypeDescription
allocatorAllocatorwhere the working storage comes from
writer&var TextWriterthe destination
specFormatSpecwhat the placeholder asked for

Returns: success when the complete rendering was accepted

Source