Struct halfpoint_rs::Half [] [src]

pub struct Half { /* fields omitted */ }

The 16 bit floating point number (half-precision floating-point). Type half can represent positive and negative numbers whose magnitude is between roughly 6.1e-5 and 6.5e+4 with a relative error of 9.8e-4; numbers smaller than 6.1e-5 can be represented with an absolute error of 6.0e-8. All integers from -2048 to +2048 can be represented exactly.

Conversions from half to float are lossless; all half numbers are exactly representable as floats.

Conversions from float to half may not preserve a float's value exactly. If a float is not representable as a half, then the float value is rounded to the nearest representable half. If a float value is exactly in the middle between the two closest representable half values, then the float value is rounded to the closest half whose least significant bit is zero.

Overflows during float-to-half conversions cause arithmetic exceptions. An overflow occurs when the float value to be converted is too large to be represented as a half, or if the float value is an infinity or a NAN.

Methods

impl Half
[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Round to n-bit precision (n should be between 0 and 10). After rounding, the significand's 10-n least significant bits will be zero.

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Get the half bits

[src]

Set the half bits

Trait Implementations

impl Clone for Half
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl From<f32> for Half
[src]

[src]

Performs the conversion.

impl Neg for Half
[src]

The resulting type after applying the - operator.

[src]

Performs the unary - operation.

impl AddAssign for Half
[src]

[src]

Performs the += operation.

impl Add<Half> for Half
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl Add<f32> for Half
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl SubAssign for Half
[src]

[src]

Performs the -= operation.

impl Sub<Half> for Half
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl Sub<f32> for Half
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl MulAssign for Half
[src]

[src]

Performs the *= operation.

impl Mul<Half> for Half
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Mul<f32> for Half
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl DivAssign for Half
[src]

[src]

Performs the /= operation.

impl Div<Half> for Half
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl Div<f32> for Half
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl Debug for Half
[src]

[src]

Formats the value using the given formatter.

impl PartialEq for Half
[src]

[src]

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

1.0.0
[src]

This method tests for !=.

impl Eq for Half
[src]