10 #if !defined(SG14_FIXED_POINT_NAMED_H) 11 #define SG14_FIXED_POINT_NAMED_H 1 15 #include "fixed_point_arithmetic.h" 32 template<
class RhsRep,
int RhsExponent>
36 using result_type =
fixed_point<decltype(-rhs.data()), RhsExponent>;
37 return result_type::from_data(-rhs.data());
52 template<
class Lhs,
class Rhs>
53 constexpr
auto add(
const Lhs& lhs,
const Rhs& rhs)
54 -> decltype(_impl::fp::operate<_impl::fp::named_function_tag>(lhs, rhs, _impl::add_tag))
56 return _impl::fp::operate<_impl::fp::named_function_tag>(lhs, rhs, _impl::add_tag);
71 template<
class Lhs,
class Rhs>
72 constexpr
auto subtract(
const Lhs& lhs,
const Rhs& rhs)
73 -> decltype(_impl::fp::operate<_impl::fp::named_function_tag>(lhs, rhs, _impl::subtract_tag))
75 return _impl::fp::operate<_impl::fp::named_function_tag>(lhs, rhs, _impl::subtract_tag);
90 template<
class Lhs,
class Rhs>
91 constexpr
auto multiply(
const Lhs& lhs,
const Rhs& rhs)
92 -> decltype(_impl::fp::operate<_impl::fp::named_function_tag>(lhs, rhs, _impl::multiply_tag))
94 return _impl::fp::operate<_impl::fp::named_function_tag>(lhs, rhs, _impl::multiply_tag);
109 template<
class Lhs,
class Rhs>
110 constexpr
auto divide(
const Lhs& lhs,
const Rhs& rhs)
111 -> decltype(_impl::fp::operate<_impl::fp::division_named_function_tag>(lhs, rhs, _impl::divide_tag))
113 return _impl::fp::operate<_impl::fp::division_named_function_tag>(lhs, rhs, _impl::divide_tag);
117 #endif // SG14_FIXED_POINT_NAMED_H constexpr auto divide(const Lhs &lhs, const Rhs &rhs) -> decltype(_impl::fp::operate< _impl::fp::division_named_function_tag >(lhs, rhs, _impl::divide_tag))
calculates the quotient of two fixed_point values
Definition: fixed_point_named.h:110
constexpr auto negate(const fixed_point< RhsRep, RhsExponent > &rhs) -> fixed_point< decltype(-rhs.data()), RhsExponent >
calculates the negative of a fixed_point value
Definition: fixed_point_named.h:33
literal real number approximation that uses fixed-point arithmetic
Definition: fixed_point_type.h:20
study group 14 of the C++ working group
Definition: const_integer.h:22