#define SG14_FIXED_POINT_H 1
#include "type_traits.h"
#include "bits/common.h"
#define SG14_FIXED_POINT_EXCEPTIONS_ENABLED
#include <stdexcept>
#include "bits/fixed_point_extras.h"
namespace sg14
{
namespace _fixed_point_impl
{
template <typename T>
using digits = std::integral_constant<int, width<T>::value-is_signed<T>::value>;
template <typename T>
using float_of_same_size = set_width_t<float, width<T>::value>;
template <typename IntType>
using next_size = typename sg14::set_width_t<IntType, width<IntType>::value*2>;
template <typename IntType>
using previous_size = typename sg14::set_width_t<IntType, width<IntType>::value/2>;
template <int Exponent, typename Output, typename Input, typename std::enable_if<
(Exponent==0),
int>::type Dummy = 0>
constexpr Output shift_left(Input i);
template <int Exponent, typename Output, typename Input, typename std::enable_if<
Exponent==0,
int>::type Dummy = 0>
constexpr Output shift_right(Input i);
template <int Exponent, typename Output, typename Input, typename std::enable_if<
!(Exponent<=0),
int>::type Dummy = 0>
constexpr Output shift_left(Input i);
template <int Exponent, typename Output, typename Input, typename std::enable_if<
!(Exponent<=0),
int>::type Dummy = 0>
constexpr Output shift_right(Input i);
template <int Exponent, typename Output, typename Input, typename std::enable_if<
(Exponent<0),
int>::type Dummy = 0>
constexpr Output shift_left(Input i);
template <int Exponent, typename Output, typename Input, typename std::enable_if<
Exponent<0,
int>::type Dummy = 0>
constexpr Output shift_right(Input i);
template <typename S, int Exponent, typename std::enable_if<Exponent==0, int>::type Dummy = 0>
constexpr S pow2();
template <typename S, int Exponent, typename std::enable_if<!(Exponent<=0) && (Exponent<8), int>::type Dummy = 0>
constexpr S pow2();
template <typename S, int Exponent, typename std::enable_if<(Exponent>=8), int>::type Dummy = 0>
constexpr S pow2();
template <typename S, int Exponent, typename std::enable_if<!(Exponent>=0) && (Exponent>-8), int>::type Dummy = 0>
constexpr S pow2();
template <typename S, int Exponent, typename std::enable_if<(Exponent<=-8), int>::type Dummy = 0>
constexpr S pow2();
template <>
struct capacity<0>;
template <unsigned N>
struct capacity;}
template <typename Rep = int, int Exponent = 0>
class fixed_point;
template <int IntegerDigits, int FractionalDigits = 0, typename Archetype = signed>
using make_fixed = fixed_point<
set_width_t<Archetype, IntegerDigits+FractionalDigits+is_signed<Archetype>::value>,
-FractionalDigits>;
template <int IntegerDigits, int FractionalDigits = 0, typename Archetype = unsigned>
using make_ufixed = make_fixed<
IntegerDigits,
FractionalDigits,
typename make_unsigned<Archetype>::type>;
namespace _fixed_point_impl
{
template <typename T>
struct is_fixed_point;
template <typename Rep, int Exponent>
struct is_fixed_point;
template <typename FixedPoint>
struct widen_integer_result;
template <typename FixedPoint>
using widen_integer_result_t = typename widen_integer_result<FixedPoint>::type;
template <typename FixedPoint>
constexpr widen_integer_result_t<FixedPoint> widen_integer(const FixedPoint& from);
template <typename FixedPoint>
struct widen_fractional_result;
template <typename FixedPoint>
using widen_fractional_result_t = typename widen_fractional_result<FixedPoint>::type;
template <typename FixedPoint>
constexpr widen_fractional_result_t<FixedPoint> widen_fractional(const FixedPoint& from);
struct default_arithmetic_policy;
template <typename LhsRep, int LhsExponent, typename RhsInteger>
struct common_type_mixed<
fixed_point<LhsRep, LhsExponent>,
RhsInteger,
typename std::enable_if<is_integral<RhsInteger>::value>::type>;
template <typename LhsRep, int LhsExponent, typename Float>
struct common_type_mixed<
fixed_point<LhsRep, LhsExponent>,
Float,
typename std::enable_if<std::is_floating_point<Float>::value>::type>;}}
namespace std{}
namespace sg14
{
namespace _fixed_point_type
{
template <typename LhsFixedPoint, typename RhsFixedPoint>
using subtract_result_rep = typename make_signed<typename std::common_type<LhsFixedPoint, RhsFixedPoint>::type>::type;
template <typename Rep>
using square_result_rep = typename make_unsigned<Rep>::type;
template <typename FixedPoint>
using sqrt_result_rep = typename make_unsigned<FixedPoint>::type;}
template <typename Result, typename Rhs>
constexpr Result negate(const Rhs& rhs);
template <typename Result, typename Lhs, typename Rhs>
constexpr Result add(const Lhs& lhs, const Rhs& rhs);
template <typename Result, typename Lhs, typename Rhs>
constexpr Result subtract(const Lhs& lhs, const Rhs& rhs);
template <typename Result, typename Lhs, typename Rhs>
constexpr Result multiply(const Lhs& lhs, const Rhs& rhs);
template <typename Result, typename Lhs, typename Rhs>
constexpr Result divide(const Lhs& lhs, const Rhs& rhs);
namespace _fixed_point_impl
{
template <typename Policy, typename Rhs>
constexpr typename Policy::template negate<Rhs>::result_type policy_negate(const Rhs& rhs);
template <typename Policy, typename Lhs, typename Rhs>
constexpr typename Policy::template add<Lhs, Rhs>::result_type policy_add(const Lhs& lhs, const Rhs& rhs);
template <typename Policy, typename Lhs, typename Rhs>
constexpr typename Policy::template subtract<Lhs, Rhs>::result_type policy_subtract(const Lhs& lhs, const Rhs& rhs);
template <typename Policy, typename Lhs, typename Rhs>
constexpr typename Policy::template multiply<Lhs, Rhs>::result_type policy_multiply(const Lhs& lhs, const Rhs& rhs);
template <typename Policy, typename Lhs, typename Rhs>
constexpr typename Policy::template divide<Lhs, Rhs>::result_type policy_divide(const Lhs& lhs, const Rhs& rhs);}
template <typename Rep, int Exponent>
constexpr bool operator==(const fixed_point<Rep, Exponent>& lhs, const fixed_point<Rep, Exponent>& rhs);
template <typename Rep, int Exponent>
constexpr bool operator!=(const fixed_point<Rep, Exponent>& lhs, const fixed_point<Rep, Exponent>& rhs);
template <typename Rep, int Exponent>
constexpr bool operator<(const fixed_point<Rep, Exponent>& lhs, const fixed_point<Rep, Exponent>& rhs);
template <typename Rep, int Exponent>
constexpr bool operator>(const fixed_point<Rep, Exponent>& lhs, const fixed_point<Rep, Exponent>& rhs);
template <typename Rep, int Exponent>
constexpr bool operator>=(const fixed_point<Rep, Exponent>& lhs, const fixed_point<Rep, Exponent>& rhs);
template <typename Rep, int Exponent>
constexpr bool operator<=(const fixed_point<Rep, Exponent>& lhs, const fixed_point<Rep, Exponent>& rhs);
template <typename RhsRep, int RhsExponent>
constexpr typename _fixed_point_impl::default_arithmetic_policy::negate<
fixed_point<RhsRep, RhsExponent>>::result_type operator-(const fixed_point<RhsRep, RhsExponent>& rhs);
template <typename LhsRep, int LhsExponent, typename RhsRep, int RhsExponent>
constexpr typename _fixed_point_impl::default_arithmetic_policy::add<
fixed_point<LhsRep, LhsExponent>,
fixed_point<RhsRep, RhsExponent>>::result_type operator+(const fixed_point<LhsRep, LhsExponent>& lhs, const fixed_point<RhsRep, RhsExponent>& rhs);
template <typename LhsRep, int LhsExponent, typename RhsRep, int RhsExponent>
constexpr typename _fixed_point_impl::default_arithmetic_policy::subtract<
fixed_point<LhsRep, LhsExponent>,
fixed_point<RhsRep, RhsExponent>>::result_type operator-(const fixed_point<LhsRep, LhsExponent>& lhs, const fixed_point<RhsRep, RhsExponent>& rhs);
template <typename LhsRep, int LhsExponent, typename RhsRep, int RhsExponent>
constexpr typename _fixed_point_impl::default_arithmetic_policy::multiply<
fixed_point<LhsRep, LhsExponent>,
fixed_point<RhsRep, RhsExponent>>::result_type operator*(const fixed_point<LhsRep, LhsExponent>& lhs, const fixed_point<RhsRep, RhsExponent>& rhs);
template <typename LhsRep, int LhsExponent, typename RhsRep, int RhsExponent>
constexpr typename _fixed_point_impl::default_arithmetic_policy::divide<
fixed_point<LhsRep, LhsExponent>,
fixed_point<RhsRep, RhsExponent>>::result_type operator/(const fixed_point<LhsRep, LhsExponent>& lhs, const fixed_point<RhsRep, RhsExponent>& rhs);
template <typename Lhs, typename Rhs>
constexpr typename std::enable_if<
_fixed_point_impl::is_fixed_point<Lhs>::value || _fixed_point_impl::is_fixed_point<Rhs>::value, bool>::type operator==(const Lhs& lhs, const Rhs& rhs);
template <typename Lhs, typename Rhs>
constexpr typename std::enable_if<
_fixed_point_impl::is_fixed_point<Lhs>::value || _fixed_point_impl::is_fixed_point<Rhs>::value, bool>::type operator!=(const Lhs& lhs, const Rhs& rhs);
template <typename Lhs, typename Rhs>
constexpr typename std::enable_if<
_fixed_point_impl::is_fixed_point<Lhs>::value || _fixed_point_impl::is_fixed_point<Rhs>::value, bool>::type operator<(const Lhs& lhs, const Rhs& rhs);
template <typename Lhs, typename Rhs>
constexpr typename std::enable_if<
_fixed_point_impl::is_fixed_point<Lhs>::value || _fixed_point_impl::is_fixed_point<Rhs>::value, bool>::type operator>(const Lhs& lhs, const Rhs& rhs);
template <typename Lhs, typename Rhs>
constexpr typename std::enable_if<
_fixed_point_impl::is_fixed_point<Lhs>::value || _fixed_point_impl::is_fixed_point<Rhs>::value, bool>::type operator>=(const Lhs& lhs, const Rhs& rhs);
template <typename Lhs, typename Rhs>
constexpr typename std::enable_if<
_fixed_point_impl::is_fixed_point<Lhs>::value || _fixed_point_impl::is_fixed_point<Rhs>::value, bool>::type operator<=(const Lhs& lhs, const Rhs& rhs);
template <typename LhsRep, int LhsExponent, typename RhsInteger, typename = typename std::enable_if<is_integral<RhsInteger>::value>::type>
constexpr decltype(lhs + fixed_point<RhsInteger, 0> operator+(const fixed_point<LhsRep, LhsExponent>& lhs, const RhsInteger& rhs);
template <typename LhsRep, int LhsExponent, typename RhsInteger, typename = typename std::enable_if<is_integral<RhsInteger>::value>::type>
constexpr decltype(lhs - fixed_point<RhsInteger, 0> operator-(const fixed_point<LhsRep, LhsExponent>& lhs, const RhsInteger& rhs);
template <typename Rep, int Exponent, typename Integer, typename = typename std::enable_if<is_integral<Integer>::value>::type>
constexpr fixed_point<decltype(std::declval<Rep>()*std::declval<Integer>()), Exponent> operator*(const fixed_point<Rep, Exponent>& lhs, const Integer& rhs);
template <typename Rep, int Exponent, typename Integer, typename = typename std::enable_if<is_integral<Integer>::value>::type>
constexpr fixed_point<decltype(std::declval<Rep>()/std::declval<Integer>()), Exponent> operator/(const fixed_point<Rep, Exponent>& lhs, const Integer& rhs);
template <typename LhsInteger, typename RhsRep, int RhsExponent, typename = typename std::enable_if<is_integral<LhsInteger>::value>::type>
constexpr decltype(fixed_point<LhsInteger, 0> operator+(const LhsInteger& lhs, const fixed_point<RhsRep, RhsExponent>& rhs);
template <typename LhsInteger, typename RhsRep, int RhsExponent, typename = typename std::enable_if<is_integral<LhsInteger>::value>::type>
constexpr decltype(fixed_point<LhsInteger, 0> operator-(const LhsInteger& lhs, const fixed_point<RhsRep, RhsExponent>& rhs);
template <typename Integer, typename Rep, int Exponent, typename = typename std::enable_if<is_integral<Integer>::value>::type>
constexpr fixed_point<decltype(std::declval<Integer>()*std::declval<Rep>()), Exponent> operator*(const Integer& lhs, const fixed_point<Rep, Exponent>& rhs);
template <typename Integer, typename Rep, int Exponent, typename = typename std::enable_if<is_integral<Integer>::value>::type>
constexpr fixed_point<decltype(std::declval<Integer>()/std::declval<Rep>()), Exponent> operator/(const Integer& lhs, const fixed_point<Rep, Exponent>& rhs);
template <typename LhsRep, int LhsExponent, typename RhsFloat, typename = typename std::enable_if<std::is_floating_point<RhsFloat>::value>::type>
constexpr _impl::common_type_t<fixed_point<LhsRep, LhsExponent>, RhsFloat> operator+(const fixed_point<LhsRep, LhsExponent>& lhs, const RhsFloat& rhs);
template <typename LhsRep, int LhsExponent, typename RhsFloat, typename = typename std::enable_if<std::is_floating_point<RhsFloat>::value>::type>
constexpr _impl::common_type_t<fixed_point<LhsRep, LhsExponent>, RhsFloat> operator-(const fixed_point<LhsRep, LhsExponent>& lhs, const RhsFloat& rhs);
template <typename LhsRep, int LhsExponent, typename RhsFloat>
constexpr _impl::common_type_t<
fixed_point<LhsRep, LhsExponent>,
typename std::enable_if<std::is_floating_point<RhsFloat>::value, RhsFloat>::type> operator*(const fixed_point<LhsRep, LhsExponent>& lhs, const RhsFloat& rhs);
template <typename LhsRep, int LhsExponent, typename RhsFloat>
constexpr _impl::common_type_t<
fixed_point<LhsRep, LhsExponent>,
typename std::enable_if<std::is_floating_point<RhsFloat>::value, RhsFloat>::type> operator/(const fixed_point<LhsRep, LhsExponent>& lhs, const RhsFloat& rhs);
template <typename LhsFloat, typename RhsRep, int RhsExponent, typename = typename std::enable_if<std::is_floating_point<LhsFloat>::value>::type>
constexpr _impl::common_type_t<LhsFloat, fixed_point<RhsRep, RhsExponent>> operator+(const LhsFloat& lhs, const fixed_point<RhsRep, RhsExponent>& rhs);
template <typename LhsFloat, typename RhsRep, int RhsExponent, typename = typename std::enable_if<std::is_floating_point<LhsFloat>::value>::type>
constexpr _impl::common_type_t<LhsFloat, fixed_point<RhsRep, RhsExponent>> operator-(const LhsFloat& lhs, const fixed_point<RhsRep, RhsExponent>& rhs);
template <typename LhsFloat, typename RhsRep, int RhsExponent>
constexpr _impl::common_type_t<
typename std::enable_if<std::is_floating_point<LhsFloat>::value, LhsFloat>::type,
fixed_point<RhsRep, RhsExponent>> operator*(const LhsFloat& lhs, const fixed_point<RhsRep, RhsExponent>& rhs);
template <typename LhsFloat, typename RhsRep, int RhsExponent>
constexpr _impl::common_type_t<
typename std::enable_if<std::is_floating_point<LhsFloat>::value, LhsFloat>::type,
fixed_point<RhsRep, RhsExponent>> operator/(const LhsFloat& lhs, const fixed_point<RhsRep, RhsExponent>& rhs);
template <typename LhsRep, int Exponent, typename Rhs>
fixed_point<LhsRep, Exponent>& operator+=(fixed_point<LhsRep, Exponent>& lhs, const Rhs& rhs);
template <typename LhsRep, int Exponent, typename Rhs>
fixed_point<LhsRep, Exponent>& operator-=(fixed_point<LhsRep, Exponent>& lhs, const Rhs& rhs);
template <typename LhsRep, int LhsExponent, typename Rhs>
constexpr fixed_point<LhsRep, LhsExponent> operator<<(const fixed_point<LhsRep, LhsExponent>& lhs, const Rhs& rhs);
template <typename LhsRep, int LhsExponent, typename Rhs>
constexpr fixed_point<LhsRep, LhsExponent> operator>>(const fixed_point<LhsRep, LhsExponent>& lhs, const Rhs& rhs);}
#define SG14_FIXED_POINT_H 1
#define SG14_FIXED_POINT_EXCEPTIONS_ENABLED
template <typename T>
using digits = std::integral_constant<int, width<T>::value-is_signed<T>::value>;
template <typename T>
using float_of_same_size = set_width_t<float, width<T>::value>;
template <typename IntType>
using next_size = typename sg14::set_width_t<IntType, width<IntType>::value*2>;
template <typename IntType>
using previous_size = typename sg14::set_width_t<IntType, width<IntType>::value/2>;
template <int Exponent, typename Output, typename Input, typename std::enable_if<
(Exponent==0),
int>::type Dummy = 0>
constexpr Output shift_left(Input i);
template <typename S, int Exponent, typename std::enable_if<Exponent==0, int>::type Dummy = 0>
constexpr S pow2();
template <unsigned N>
struct capacity
{
static constexpr int value = capacity<N/2>::+1;
};
template <typename Rep = int, int Exponent = 0>
class fixed_point
{
public:
using rep = Rep;
static constexpr int exponent = Exponent;
static constexpr int digits = _fixed_point_impl::<Rep>::value;
static constexpr int integer_digits = digits+exponent;
static constexpr int fractional_digits = -exponent;
public:
fixed_point();
template <typename S, typename std::enable_if<is_integral<S>::value, int>::type Dummy = 0>
explicit constexpr fixed_point(S s);
template <typename S, typename std::enable_if<std::is_floating_point<S>::value, int>::type Dummy = 0>
explicit constexpr fixed_point(S s);
template <typename FromRep, int FromExponent>
explicit constexpr fixed_point(const fixed_point<FromRep, FromExponent>& rhs);
template <typename S, typename std::enable_if<is_integral<S>::value, int>::type Dummy = 0>
fixed_point& operator=(S s);
template <typename S, typename std::enable_if<std::is_floating_point<S>::value, int>::type Dummy = 0>
fixed_point& operator=(S s);
template <typename FromRep, int FromExponent>
fixed_point& operator=(const fixed_point<FromRep, FromExponent>& rhs);
template <typename S, typename std::enable_if<is_integral<S>::value, int>::type Dummy = 0>
explicit constexpr operator S() const;
template <typename S, typename std::enable_if<std::is_floating_point<S>::value, int>::type Dummy = 0>
explicit constexpr operator S() const;
explicit constexpr operator bool() const;
template <typename Rhs>
fixed_point& operator*=(const Rhs& rhs);
template <typename Rhs>
fixed_point& operator/=(const Rhs& rhs);
constexpr rep data() const;
static constexpr fixed_point from_data(rep r);
};
literal real number approximation that uses fixed-point arithmetic
To define a fixed-point value 1 byte in size with a sign bit, 3 integer bits and 4 fractional bits: \snippet snippets.cpp define a fixed_point value
using rep = Rep;
alias to template parameter, \a Rep
static constexpr int exponent = Exponent;
value of template parameter, \a Exponent
static constexpr int digits = _fixed_point_impl::<Rep>::value;
number of binary digits this type can represent; equivalent to std::numeric_limits::digits
static constexpr int integer_digits = digits+exponent;
number of binary digits devoted to integer part of value; can be negative for specializations with especially small ranges
static constexpr int fractional_digits = -exponent;
number of binary digits devoted to fractional part of value; can be negative for specializations with especially large ranges
fixed_point();
default constructor
template <typename S, typename std::enable_if<is_integral<S>::value, int>::type Dummy = 0>
explicit constexpr fixed_point(S s);
constructor taking an integer type
template <typename S, typename std::enable_if<std::is_floating_point<S>::value, int>::type Dummy = 0>
explicit constexpr fixed_point(S s);
constructor taking a floating-point type
template <typename FromRep, int FromExponent>
explicit constexpr fixed_point(const fixed_point<FromRep, FromExponent>& rhs);
constructor taking a fixed-point type
template <typename S, typename std::enable_if<is_integral<S>::value, int>::type Dummy = 0>
fixed_point& operator=(S s);
copy assignment operator taking an integer type
template <typename S, typename std::enable_if<std::is_floating_point<S>::value, int>::type Dummy = 0>
fixed_point& operator=(S s);
copy assignment operator taking a floating-point type
template <typename FromRep, int FromExponent>
fixed_point& operator=(const fixed_point<FromRep, FromExponent>& rhs);
copy assignement operator taking a fixed-point type
template <typename S, typename std::enable_if<is_integral<S>::value, int>::type Dummy = 0>
explicit constexpr operator S() const;
returns value represented as integral
template <typename S, typename std::enable_if<std::is_floating_point<S>::value, int>::type Dummy = 0>
explicit constexpr operator S() const;
returns value represented as floating-point
explicit constexpr operator bool() const;
returns non-zeroness represented as boolean
constexpr rep data() const;
returns internal representation of value
static constexpr fixed_point from_data(rep r);
creates an instance given the underlying representation value
template <int IntegerDigits, int FractionalDigits = 0, typename Archetype = signed>
using make_fixed = fixed_point<
set_width_t<Archetype, IntegerDigits+FractionalDigits+is_signed<Archetype>::value>,
-FractionalDigits>;
Produce a fixed-point type with the given number of integer and fractional digits.
Remarks: The signage of \a Archetype specifies signage of the resultant fixed-point type. \remarks Typical choices for \a Archetype, signed
and unsigned
, result in a type that uses built-in integers for \a fixed_point::rep. \remarks Resultant type is signed by default.
To generate a fixed-point type with a sign bit, 8 fractional bits and at least 7 integer bits: \snippet snippets.cpp use make_fixed
template <int IntegerDigits, int FractionalDigits = 0, typename Archetype = unsigned>
using make_ufixed = make_fixed<
IntegerDigits,
FractionalDigits,
typename make_unsigned<Archetype>::type>;
Produce an unsigned fixed-point type with the given number of integer and fractional digits.
template <typename T>
struct is_fixed_point
: std::false_type
{};
template <typename FixedPoint>
struct widen_fractional_result
{
using prev_rep = typename FixedPoint::rep;
using next_rep = _fixed_point_impl::next_size<prev_rep>;
using type = fixed_point<
next_rep,
FixedPoint::exponent+static_cast<int>(width<prev_rep>::value)
-static_cast<int>(width<next_rep>::value)>;
};
struct default_arithmetic_policy
{
template <typename Lhs, typename Rhs>
struct common_type;
template <typename Lhs, typename Rhs>
struct operator_base;
template <typename Rhs>
struct negate;
template <typename Lhs, typename Rhs>
struct add;
template <typename Lhs, typename Rhs>
struct subtract;
template <typename Lhs, typename Rhs>
struct multiply;
template <typename Lhs, typename Rhs>
struct divide;
};
template <typename LhsFixedPoint, typename RhsFixedPoint>
using subtract_result_rep = typename make_signed<typename std::common_type<LhsFixedPoint, RhsFixedPoint>::type>::type;
template <typename Result, typename Rhs>
constexpr Result negate(const Rhs& rhs);
calculates the negative of a \ref fixed_point value
template <typename Result, typename Lhs, typename Rhs>
constexpr Result add(const Lhs& lhs, const Rhs& rhs);
calculates the sum of two \ref fixed_point values
template <typename Result, typename Lhs, typename Rhs>
constexpr Result subtract(const Lhs& lhs, const Rhs& rhs);
calculates the difference of two \ref fixed_point values
template <typename Result, typename Lhs, typename Rhs>
constexpr Result multiply(const Lhs& lhs, const Rhs& rhs);
calculates the product of two \ref fixed_point factors
template <typename Result, typename Lhs, typename Rhs>
constexpr Result divide(const Lhs& lhs, const Rhs& rhs);
calculates the quotient of two \ref fixed_point values
template <typename Policy, typename Rhs>
constexpr typename Policy::template negate<Rhs>::result_type policy_negate(const Rhs& rhs);
template <typename Lhs, typename Rhs>
constexpr typename std::enable_if<
_fixed_point_impl::is_fixed_point<Lhs>::value || _fixed_point_impl::is_fixed_point<Rhs>::value, bool>::type operator==(const Lhs& lhs, const Rhs& rhs);
template <typename LhsRep, int LhsExponent, typename Rhs>
constexpr fixed_point<LhsRep, LhsExponent> operator<<(const fixed_point<LhsRep, LhsExponent>& lhs, const Rhs& rhs);