Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
Loading...
Searching...
No Matches
areal_impl.hpp File Reference

Classes

class  sw::universal::areal< _nbits, _es, bt >
 An arbitrary configuration real number with gradual under/overflow and uncertainty bit. More...

Namespaces

namespace  sw
 required std libraries
namespace  sw::universal
namespace  sw::universal::areal_parse

Macros

#define AREAL_ENABLE_LITERALS   1
#define AREAL_THROW_ARITHMETIC_EXCEPTION   0
#define TRACE_CONVERSION   0
#define THROW_ARITHMETIC_EXCEPTION   0

Functions

template<unsigned nbits, unsigned es, typename bt>
bool sw::universal::parse (const std::string &txt, areal< nbits, es, bt > &v)
template<unsigned nbits, unsigned es, typename bt>
areal< nbits, es, bt > sw::universal::abs (const areal< nbits, es, bt > &v)
 Magnitude: the sign bit off, the value bits and the ubit kept, so an inexact value stays inexact and (-0, minneg) becomes (0, minpos).
template<unsigned nbits, unsigned es, typename bt>
areal< nbits, es, bt > sw::universal::fma (const areal< nbits, es, bt > &, const areal< nbits, es, bt > &, const areal< nbits, es, bt > &)
template<unsigned nbits, unsigned es, unsigned fbits, typename bt>
void sw::universal::decode (const areal< nbits, es, bt > &v, bool &s, blockbinary< es, bt > &e, blockbinary< fbits, bt > &f, bool &ubit)
 decode an areal value into its constituent parts
template<unsigned nbits, unsigned es, typename bt>
int sw::universal::scale (const areal< nbits, es, bt > &v)
 return the binary scale of the given number
template<unsigned srcbits, BlockTripleOperator op, unsigned nbits, unsigned es, typename bt>
constexpr void sw::universal::convert (const blocktriple< srcbits, op, bt > &src, areal< nbits, es, bt > &tgt, bool inputUncertain=false)
 convert a blocktriple to an areal with ubit propagation The ubit is set if: inputUncertain || rounding occurred
bool sw::universal::areal_parse::is_space (char c)
std::string_view sw::universal::areal_parse::trim (std::string_view s)
int sw::universal::areal_parse::special_value (std::string_view s, bool &negative)
template<unsigned BigBits, unsigned nbits, unsigned es, typename bt>
bool sw::universal::areal_parse::from_binary (const ::sw::universal::decimal_to_binary::basic_result< BigBits > &d, areal< nbits, es, bt > &v)
template<unsigned nbits, unsigned es, typename bt>
bool sw::universal::areal_parse::faithful (std::string_view s, areal< nbits, es, bt > &v)
template<unsigned nbits, unsigned es, typename bt>
bool sw::universal::areal_parse::nearest_exact (std::string_view s, areal< nbits, es, bt > &v)
template<unsigned nbits, unsigned es, typename bt>
bool sw::universal::areal_parse::adjacent (const areal< nbits, es, bt > &lo, const areal< nbits, es, bt > &hi)
template<unsigned nnbits, unsigned nes, typename nbt>
constexpr bool sw::universal::operator== (const areal< nnbits, nes, nbt > &lhs, const areal< nnbits, nes, nbt > &rhs)
template<unsigned nnbits, unsigned nes, typename nbt>
constexpr bool sw::universal::operator!= (const areal< nnbits, nes, nbt > &lhs, const areal< nnbits, nes, nbt > &rhs)
template<unsigned nnbits, unsigned nes, typename nbt>
constexpr bool sw::universal::operator< (const areal< nnbits, nes, nbt > &lhs, const areal< nnbits, nes, nbt > &rhs)
template<unsigned nnbits, unsigned nes, typename nbt>
constexpr bool sw::universal::operator> (const areal< nnbits, nes, nbt > &lhs, const areal< nnbits, nes, nbt > &rhs)
template<unsigned nnbits, unsigned nes, typename nbt>
constexpr bool sw::universal::operator<= (const areal< nnbits, nes, nbt > &lhs, const areal< nnbits, nes, nbt > &rhs)
template<unsigned nnbits, unsigned nes, typename nbt>
constexpr bool sw::universal::operator>= (const areal< nnbits, nes, nbt > &lhs, const areal< nnbits, nes, nbt > &rhs)
template<unsigned nbits, unsigned es, typename bt>
constexpr areal< nbits, es, bt > sw::universal::operator+ (const areal< nbits, es, bt > &lhs, const areal< nbits, es, bt > &rhs)
template<unsigned nbits, unsigned es, typename bt>
constexpr areal< nbits, es, bt > sw::universal::operator- (const areal< nbits, es, bt > &lhs, const areal< nbits, es, bt > &rhs)
template<unsigned nbits, unsigned es, typename bt>
constexpr areal< nbits, es, bt > sw::universal::operator* (const areal< nbits, es, bt > &lhs, const areal< nbits, es, bt > &rhs)
template<unsigned nbits, unsigned es, typename bt>
constexpr areal< nbits, es, bt > sw::universal::operator/ (const areal< nbits, es, bt > &lhs, const areal< nbits, es, bt > &rhs)
template<unsigned nbits, unsigned es, typename bt>
constexpr bool sw::universal::operator== (const areal< nbits, es, bt > &lhs, long long rhs)
 binary logic literal comparisons
template<unsigned nbits, unsigned es, typename bt>
constexpr bool sw::universal::operator!= (const areal< nbits, es, bt > &lhs, long long rhs)
template<unsigned nbits, unsigned es, typename bt>
constexpr bool sw::universal::operator< (const areal< nbits, es, bt > &lhs, long long rhs)
template<unsigned nbits, unsigned es, typename bt>
constexpr bool sw::universal::operator> (const areal< nbits, es, bt > &lhs, long long rhs)
template<unsigned nbits, unsigned es, typename bt>
constexpr bool sw::universal::operator<= (const areal< nbits, es, bt > &lhs, long long rhs)
template<unsigned nbits, unsigned es, typename bt>
constexpr bool sw::universal::operator>= (const areal< nbits, es, bt > &lhs, long long rhs)

Variables

constexpr bool sw::universal::AREAL_NIBBLE_MARKER = true

Macro Definition Documentation

◆ AREAL_ENABLE_LITERALS

#define AREAL_ENABLE_LITERALS   1

◆ AREAL_THROW_ARITHMETIC_EXCEPTION

#define AREAL_THROW_ARITHMETIC_EXCEPTION   0

◆ THROW_ARITHMETIC_EXCEPTION

#define THROW_ARITHMETIC_EXCEPTION   0

◆ TRACE_CONVERSION

#define TRACE_CONVERSION   0