|
Uni20
Asynchronous tensor and runtime library.
|
Defines basic_half_int<T>, a signed integer type with half-integer resolution.
More...
#include <uni20/common/trace.hpp>#include <uni20/core/numeric_limits.hpp>#include <charconv>#include <cmath>#include <compare>#include <concepts>#include <cstddef>#include <cstdint>#include <format>#include <functional>#include <ios>#include <iosfwd>#include <istream>#include <limits>#include <ostream>#include <stdexcept>#include <string>#include <string_view>#include <system_error>Go to the source code of this file.
Classes | |
| struct | std::formatter< uni20::basic_half_int< T >, CharT > |
| struct | std::hash< uni20::basic_half_int< T > > |
| class | uni20::basic_half_int< T > |
| Signed value type that stores multiples of one half exactly. More... | |
| struct | uni20::basic_half_int< T >::twice_tag |
| Tag type used to construct directly from the doubled representation. More... | |
| struct | uni20::numeric_limits< basic_half_int< T > > |
| Exact representation properties and range of a half-integer scalar. More... | |
Namespaces | |
| namespace | uni20 |
Typedefs | |
| using | uni20::half_int = basic_half_int< std::int64_t > |
| Default half-integer type used by Uni20. | |
Functions | |
| template<std::signed_integral T> | |
| constexpr auto | uni20::abs (basic_half_int< T > value) -> basic_half_int< T > |
| Return the absolute value of a half-integer. | |
| template<std::signed_integral T> | |
| constexpr auto | uni20::from_twice (T twice_value) -> basic_half_int< T > |
| Construct a half-integer from its doubled representation. | |
| template<std::signed_integral T> | |
| constexpr auto | uni20::is_integral (basic_half_int< T > value) -> bool |
| Return whether a half-integer value is integral. | |
| template<std::signed_integral T> | |
| constexpr auto | uni20::is_triangle (basic_half_int< T > a, basic_half_int< T > b, basic_half_int< T > c) -> bool |
| Return whether three nonnegative half-integers satisfy the triangle condition. | |
| template<std::integral T> | |
| constexpr auto | uni20::minus1pow (T value) -> int |
Return (-1)^x for an integral exponent. | |
| template<std::signed_integral T> | |
| constexpr auto | uni20::operator* (basic_half_int< T > lhs, basic_half_int< T > rhs) -> double |
| Multiply two half-integer values as floating-point numbers. | |
| template<std::signed_integral T, std::integral U> | |
| constexpr auto | uni20::operator* (basic_half_int< T > lhs, U rhs) -> basic_half_int< T > |
| Multiply a half-integer value by an integral scalar. | |
| template<std::integral U, std::signed_integral T> | |
| constexpr auto | uni20::operator* (U lhs, basic_half_int< T > rhs) -> basic_half_int< T > |
| Multiply an integral scalar by a half-integer value. | |
| template<std::signed_integral T> | |
| constexpr auto | uni20::operator+ (basic_half_int< T > lhs, basic_half_int< T > rhs) -> basic_half_int< T > |
| Add two half-integer values. | |
| template<std::signed_integral T> | |
| constexpr auto | uni20::operator- (basic_half_int< T > lhs, basic_half_int< T > rhs) -> basic_half_int< T > |
| Subtract two half-integer values. | |
| template<std::signed_integral T> | |
| constexpr auto | uni20::operator- (basic_half_int< T > value) -> basic_half_int< T > |
| Negate a half-integer value. | |
| template<std::signed_integral T, std::floating_point U> | |
| constexpr auto | uni20::operator/ (basic_half_int< T > lhs, U rhs) -> U |
| Divide a half-integer value by a floating-point scalar. | |
| template<std::signed_integral T> | |
| auto | uni20::operator<< (std::ostream &out, basic_half_int< T > value) -> std::ostream & |
Stream a half-integer in integer or .5 decimal form. | |
| template<std::signed_integral T> | |
| auto | uni20::operator>> (std::istream &in, basic_half_int< T > &value) -> std::istream & |
Parse a half-integer from integer, .0, .5, or n/2 form. | |
| template<std::signed_integral T> | |
| constexpr auto | uni20::to_int (basic_half_int< T > value) -> T |
| Convert a half-integer to its integral value. | |
| template<std::signed_integral T> | |
| constexpr auto | uni20::to_int_assert (basic_half_int< T > value) -> T |
| Convert a half-integer to its integral value assuming exact integrality. | |
| template<std::signed_integral T> | |
| auto | uni20::to_string (basic_half_int< T > value) -> std::string |
Format a half-integer as an integer or decimal .5. | |
| template<std::signed_integral T> | |
| auto | uni20::to_string_fraction (basic_half_int< T > value) -> std::string |
Format a half-integer as an integer or n/2. | |
Defines basic_half_int<T>, a signed integer type with half-integer resolution.