25 #include <type_traits> 48 static_assert(std::is_floating_point<T>(),
"Can only calculate the precision of addition between floating point types");
51 if ((f1 == 0) || (f2 == 0) || (std::signbit(f1) != std::signbit(f2)))
52 return std::numeric_limits<size_t>::max();
55 std::frexp(f1, &exp1);
56 std::frexp(f2, &exp2);
The stator symbolic math library.
size_t addition_precision(const T f1, const T f2)
Calculate a "precision" for addition between two float types.
constexpr C<(1 - 2 *(num< 0)) *num,(1 - 2 *(den< 0)) *den > abs(const C< num, den > &a)
size_t subtraction_precision(const T f1, const T f2)
Calculate a "precision" for subtraction between two float types.