Crate rustc_apfloat[][src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Port of LLVM's APFloat software floating-point implementation from the following C++ sources (please update commit hash when backporting): https://github.com/llvm-mirror/llvm/tree/23efab2bbd424ed13495a420ad8641cb2c6c28f9

The port contains no unsafe code, global state, or side-effects in general, and the only allocations are in the conversion to/from decimal strings.

Most of the API and the testcases are intact in some form or another, with some ergonomic changes, such as idiomatic short names, returning new values instead of mutating the receiver, and having separate method variants that take a non-default rounding mode (with the suffix _r). Comments have been preserved where possible, only slightly adapted.

Instead of keeping a pointer to a configuration struct and inspecting it dynamically on every operation, types (e.g. ieee::Double), traits (e.g. ieee::Semantics) and associated constants are employed for increased type safety and performance.

On-heap bigints are replaced everywhere (except in decimal conversion), with short arrays of type Limb = u128 elements (instead of u64), This allows fitting the largest supported significands in one integer (ieee::Quad and ppc::Fallback use slightly less than 128 bits). All of the functions in the ieee::sig module operate on slices.

Note

This API is completely unstable and subject to change.

Modules

ieee [
Experimental
]
ppc [
Experimental
]

Macros

unpack [
Experimental
]

Structs

ParseError [
Experimental
]
Status [
Experimental
]

IEEE-754R 7: Default exception handling.

StatusAnd [
Experimental
]

Enums

Category [
Experimental
]

Category of internally-represented number.

Round [
Experimental
]

IEEE-754R 4.3: Rounding-direction attributes.

Constants

IEK_INF [
Experimental
]
IEK_NAN [
Experimental
]
IEK_ZERO [
Experimental
]

Traits

Float [
Experimental
]

A self-contained host- and target-independent arbitrary-precision floating-point software implementation.

FloatConvert [
Experimental
]

Type Definitions

ExpInt [
Experimental
]

A signed type to represent a floating point number's unbiased exponent.