template <typename Integer, size_t FractionalBits>

class Fixed

Defined at line 41 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Forward declaration.

Public Methods

Fixed<Integer, FractionalBits> FromRaw (Integer value)

Returns the given raw integer as a fixed-point value in this format.

Defined at line 48 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Fixed<Integer, FractionalBits> Min ()

Returns the minimum value of this fixed point format.

Defined at line 53 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Fixed<Integer, FractionalBits> Max ()

Returns the maximum value of this fixed point format.

Defined at line 56 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Fixed<Integer, FractionalBits> Epsilon ()

Returns the smallest positive value of this fixed point format.

Defined at line 59 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

void Fixed<Integer, FractionalBits> ()

Fixed is default constructible without a default value, which is the same

as for plain integer types. This is permitted in constexpr contexts as

long as the underling integer member |value_| is initialized before use.

Defined at line 64 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

void Fixed<Integer, FractionalBits> (const Fixed<Integer, FractionalBits> & )

Fixed is copy constructible and copy assignable.

Defined at line 67 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Fixed<Integer, FractionalBits> & operator= (const Fixed<Integer, FractionalBits> & )

All assignment operators are intentionally lvalue reference qualified to

prevent assignments to temporaries, which can create surprising behavior

compared to plain integers and result in silent data loss.

Defined at line 72 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

void Fixed<Integer, FractionalBits> (Integer value)

Explicit conversion from an integer value. The value is saturated to fit

within the integer precision defined by Format::IntegerBits.

Defined at line 76 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

template <Operation Op, typename... Args>
void Fixed<Integer, FractionalBits> (Expression<Op, Args...> expression)

Implicit conversion from an intermediate expression. The value is converted

to the precision and resolution of this type, if necessary.

Defined at line 81 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

template <typename OtherInteger, size_t OtherFractionalBits, typename = std::enable_if_t<!std::is_same_v<Integer, OtherInteger> ||
                                                            FractionalBits != OtherFractionalBits>>
void Fixed<Integer, FractionalBits> (const Fixed<OtherInteger, OtherFractionalBits> & other)

Explicit conversion from another fixed point type. The value is converted

to the precision and resolution of this type, if necessary.

Defined at line 89 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

template <Operation Op, typename... Args>
Fixed<Integer, FractionalBits> & operator= (Expression<Op, Args...> expression)

Assignment from an intermediate expression. The value is rounded and

saturated to fit within the precision and resolution of this type, if

necessary.

All assignment operators are intentionally lvalue reference qualified to

prevent assignments to temporaries, which can create surprising behavior

compared to plain integers and result in silent data loss.

Defined at line 100 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

void Fixed<Integer, FractionalBits> (Value<Format> value)

Implicit conversion from an intermediate value of the same format.

Defined at line 105 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Fixed<Integer, FractionalBits> & operator= (Value<Format> value)

Assignment from an intermediate value of the same format.

All assignment operators are intentionally lvalue reference qualified to

prevent assignments to temporaries, which can create surprising behavior

compared to plain integers and result in silent data loss.

Defined at line 112 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Integer raw_value ()

Returns the raw fixed-point value as the underling integer type.

Defined at line 115 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Value<Format> value ()

Returns the fixed-point value as an intermediate value type.

Defined at line 118 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Integer Ceiling ()

Returns the closest integer value greater-than or equal-to this fixed-

point value.

Defined at line 122 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Integer Floor ()

Returns the closest integer value less-than or equal-to this fixed-point

value.

Defined at line 133 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Integer Round ()

Returns the rounded value of this fixed-point value as an integer.

Defined at line 141 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Fixed<Integer, FractionalBits> Integral ()

Returns the integral component of this fixed-point value. The result retains

the sign of this value. For example, Fixed{-2.5}.Integral() == -2.

This preserves the following invariant:

Fixed f;

f.Integral() + f.Fraction() == f

Defined at line 156 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Fixed<Integer, FractionalBits> Fraction ()

Returns the fractional component of this fixed-point value. The result retains

the sign of this value. For example, Fixed(-2.5).Fraction() == -0.5.

See Integral().

Defined at line 173 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

Fixed<Integer, FractionalBits> Absolute ()

Returns the absolute value of this fixed-point value.

Defined at line 176 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

bool operator< (Fixed<Integer, FractionalBits> other)

Relational operators for same-typed values.

Defined at line 194 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

bool operator> (Fixed<Integer, FractionalBits> other)

Defined at line 195 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

bool operator<= (Fixed<Integer, FractionalBits> other)

Defined at line 196 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

bool operator>= (Fixed<Integer, FractionalBits> other)

Defined at line 197 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

bool operator== (Fixed<Integer, FractionalBits> other)

Defined at line 198 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

bool operator!= (Fixed<Integer, FractionalBits> other)

Defined at line 199 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

template <typename T, typename Enabled = EnableIfUnaryExpression<T>>
Fixed<Integer, FractionalBits> & operator+= (T expression)

Compound assignment operators.

All assignment operators are intentionally lvalue reference qualified to

prevent assignments to temporaries, which can create surprising behavior

compared to plain integers and result in silent data loss.

Defined at line 207 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

template <typename T, typename Enabled = EnableIfUnaryExpression<T>>
Fixed<Integer, FractionalBits> & operator-= (T expression)

Defined at line 212 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

template <typename T, typename Enabled = EnableIfUnaryExpression<T>>
Fixed<Integer, FractionalBits> & operator*= (T expression)

Defined at line 217 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h

template <typename T, typename Enabled = EnableIfUnaryExpression<T>>
Fixed<Integer, FractionalBits> & operator/= (T expression)

Defined at line 222 of file ../../zircon/system/ulib/ffl/include/ffl/fixed.h