numeric.fixed ≡
template <auto I, auto F> struct fixed §
Fixed-point representation.
Parameters
-
auto IInteger bit-width.
-
auto FFractional bit-width.
Fields
-
int<(I + F)> value §
template <auto I, auto F> inline optional<fixed<I, F>> round(fixed<I, F> x) §
Round half up.
Examples
>>> round(-23.5)
-23
>>> round(23.5)
24
template <auto I, auto F> inline optional<fixed<I, F>> ceil(fixed<I, F> x) §
Ceiling.
template <auto I, auto F> inline fixed<I, F> floor(fixed<I, F> x) §
template <auto I, auto F> inline fixed<I, F> trunc(fixed<I, F> x) §
Truncate.
template <auto I, auto F> inline optional<fixed<I, F>> abs(fixed<I, F> x) §
Return the absolute value of x.
template <auto I, auto F> inline fixed<I, F> min(fixed<I, F> x, fixed<I, F> y) §
Return the smaller of x and y.
template <auto I, auto F> inline fixed<I, F> max(fixed<I, F> x, fixed<I, F> y) §
Return the larger of x and y.
template <auto I, auto F> inline optional<fixed<I, F>> dim(fixed<I, F> x, fixed<I, F> y) §
Return the positive difference between x and y,
i.e. max(x - y, 0).
template <auto I, auto F> inline optional<fixed<I, F>> reciprocal(fixed<I, F> x) §
template <auto I, auto F> inline optional<fixed<I, F>> log2(fixed<I, F> x) §
Base-2 logarithm.
template <auto I, auto F> inline optional<fixed<I, F>> log10(fixed<I, F> x) §
Base-10 logarithm.
template <auto I, auto F> inline optional<fixed<I, F>> log(fixed<I, F> x) §
Base-e logarithm.
template <auto I, auto F> inline fixed<I, F> sin(fixed<I, F> x) §
template <auto I, auto F> inline fixed<I, F> cos(fixed<I, F> x) §
template <auto I, auto F> inline optional<fixed<I, F>> exp2(fixed<I, F> x) §
Base-2 exponent.
template <auto I, auto F> inline optional<fixed<I, F>> exp(fixed<I, F> x) §
Base-e exponent.
template <auto I, auto F> inline optional<fixed<I, F>> invsqrt(fixed<I, F> x) §
Return the reciprocal of the square root of x.
template <auto I, auto F> inline optional<fixed<I, F>> sqrt(fixed<I, F> x) §
Return the square root of x. This function provides better accuracy
than calling invsqrt and then multiplying by x.
template <auto I, auto F> inline optional<fixed<I, F>> pow(fixed<I, F> base, fixed<I, F> expo) §
Raise base to the power of expo.