CNL  2.0.2 (development)
Compositional Numeric Library
elastic_scaled_integer.h File Reference

essential definitions related to the cnl::elastic_scaled_integer type More...

#include "_impl/charconv/descale.h"
#include "_impl/numbers/adopt_signedness.h"
#include "_impl/scaled/is_scaled_tag.h"
#include "_impl/scaled/power.h"
#include "elastic_integer.h"
#include "scaled_integer.h"
#include <algorithm>
#include <limits>
#include <type_traits>

Go to the source code of this file.

Namespaces

 cnl
 compositional numeric library
 
 cnl::literals
 user-defined literals
 

Typedefs

template<int Digits, scaled_tag Scale = power<>, class Narrowest = signed>
using cnl::elastic_scaled_integer = scaled_integer< elastic_integer< Digits, Narrowest >, Scale >
 literal real number approximation that uses fixed-point arithmetic and auto-widens to avoid overflow More...
 

Functions

template<typename Narrowest = int, ::cnl::intmax_t Value = 0>
constexpr auto cnl::make_elastic_scaled_integer (constant< Value >) -> elastic_scaled_integer< std::max(digits_v< constant< Value >> - trailing_bits(Value), 1), power< trailing_bits(Value)>, Narrowest >
 generate an elastic_scaled_integer object of given value More...
 
template<typename Narrowest = void, typename Integral = int>
constexpr auto cnl::make_elastic_scaled_integer (Integral const &value) -> elastic_scaled_integer< std::numeric_limits< Integral >::digits, power<>, typename std::conditional< std::is_same< void, Narrowest >::value, _impl::adopt_signedness_t< int, Integral >, Narrowest >::type >
 generate an elastic_scaled_integer object of given value More...
 
template<char... Chars>
constexpr auto cnl::literals::operator""_cnl ()
 generate an elastic_scaled_integer object using a literal More...
 
template<char... Chars>
constexpr auto cnl::literals::operator""_cnl2 ()
 generate an elastic_scaled_integer object using a binary literal More...
 

Detailed Description

essential definitions related to the cnl::elastic_scaled_integer type