#include <fastmm/core/fixed_point.hpp>
|
| static constexpr Fixed | from_raw (std::int64_t r) noexcept |
| |
| static constexpr Fixed | from_int (std::int64_t units) noexcept |
| | Whole units, e.g. from_int(100) == 100.00000000.
|
| |
| static constexpr Fixed | zero () noexcept |
| |
| static constexpr Fixed | max () noexcept |
| |
| static constexpr Fixed | min () noexcept |
| |
| static constexpr std::optional< Fixed > | from_decimal (std::string_view s) noexcept |
| | Exact parse of "[+-]digits[.digits]".
|
| |
| static constexpr std::optional< Fixed > | parse (std::string_view s) noexcept |
| | Exact parse of a decimal in plain or exponent notation: "0.1", "2e-05", "1.5E3", "-3".
|
| |
| static Fixed | from_bps (double bps) noexcept |
| | Ratio only.
|
| |
| static std::optional< Fixed > | from_bps_checked (double bps) noexcept |
| |
| static Fixed | from_double (double d) noexcept |
| | Rounds to the 1e-8 grid.
|
| |
| static std::optional< Fixed > | from_double_checked (double d) noexcept |
| | nullopt for NaN, +-inf and anything outside the representable range; two compares more.
|
| |
◆ rep_type
◆ Fixed()
◆ from_raw()
template<class Tag >
|
|
inlinestaticconstexprnoexcept |
◆ from_int()
template<class Tag >
|
|
inlinestaticconstexprnoexcept |
Whole units, e.g. from_int(100) == 100.00000000.
◆ zero()
template<class Tag >
|
|
inlinestaticconstexprnoexcept |
◆ max()
template<class Tag >
|
|
inlinestaticconstexprnoexcept |
◆ min()
template<class Tag >
|
|
inlinestaticconstexprnoexcept |
◆ from_decimal()
template<class Tag >
| static constexpr std::optional< Fixed > fastmm::Fixed< Tag >::from_decimal |
( |
std::string_view |
s | ) |
|
|
inlinestaticconstexprnoexcept |
Exact parse of "[+-]digits[.digits]".
Rejects: empty, >8 significant fraction digits, integer overflow, exponents, whitespace. Trailing zeros beyond 8 places are accepted.
< 92233720368
< s[i] == '.'
< would lose precision
◆ parse()
template<class Tag >
|
|
inlinestaticconstexprnoexcept |
Exact parse of a decimal in plain or exponent notation: "0.1", "2e-05", "1.5E3", "-3".
Used for configuration values (TOML floats arrive formatted by fmt, Python floats by repr). Rejects a value only if more than 8 decimals remain after applying the exponent, or it is out of range. Venue strings use the stricter from_decimal.
◆ from_bps()
◆ from_bps_checked()
◆ to_bps()
Ratio only. Diagnostics only.
◆ to_decimal()
Formats into buf (>= kMaxDecimalChars), trims trailing zeros ("1.5", "100", "0.00000001").
Returns the number of chars written; no NUL is appended.
integer part
◆ from_double()
Rounds to the 1e-8 grid.
NaN becomes zero and a value outside +-92,233,720,368.54775807 saturates at max()/min(); the unchecked cast this replaced made both INT64_MIN.
◆ from_double_checked()
nullopt for NaN, +-inf and anything outside the representable range; two compares more.
◆ to_double()
◆ is_zero()
◆ is_positive()
◆ is_negative()
◆ abs()
◆ units()
◆ operator<=>()
◆ operator-()
◆ operator+=()
◆ operator-=()
◆ operator*=()
◆ operator+
◆ operator-
◆ operator* [1/2]
template<class Tag >
| constexpr Fixed operator* |
( |
Fixed< Tag > |
a, |
|
|
std::int64_t |
k |
|
) |
| |
|
friend |
◆ operator* [2/2]
template<class Tag >
| constexpr Fixed operator* |
( |
std::int64_t |
k, |
|
|
Fixed< Tag > |
a |
|
) |
| |
|
friend |
◆ operator/ [1/2]
template<class Tag >
| constexpr Fixed operator/ |
( |
Fixed< Tag > |
a, |
|
|
std::int64_t |
k |
|
) |
| |
|
friend |
◆ operator/ [2/2]
template<class Tag >
| constexpr std::int64_t operator/ |
( |
Fixed< Tag > |
a, |
|
|
Fixed< Tag > |
b |
|
) |
| |
|
friend |
Number of whole ticks in a (truncating); result is a plain integer.
◆ operator%
◆ raw