Expand Up
@@ -12,7 +12,6 @@
#include " src/__support/CPP/string_view.h"
#include " src/__support/FPUtil/FPBits.h"
#include " src/__support/FPUtil/fpbits_str.h"
#include " src/__support/macros/properties/types.h"
#include " test/UnitTest/FPMatcher.h"
#include " hdr/math_macros.h"
Expand All
@@ -31,12 +30,6 @@ namespace mpfr {
// precision compared to the floating point precision.
template <typename T> struct ExtraPrecision ;
#ifdef LIBC_TYPES_HAS_FLOAT16
template <> struct ExtraPrecision <float16> {
static constexpr unsigned int VALUE = 128 ;
};
#endif
template <> struct ExtraPrecision <float > {
static constexpr unsigned int VALUE = 128 ;
};
Expand Down
Expand Up
@@ -92,16 +85,9 @@ class MPFRNumber {
// We use explicit EnableIf specializations to disallow implicit
// conversions. Implicit conversions can potentially lead to loss of
// precision. We exceptionally allow implicit conversions from float16
// to float, as the MPFR API does not support float16, thus requiring
// conversion to a higher-precision format.
// precision.
template <typename XType,
cpp::enable_if_t <cpp::is_same_v<float , XType>
#ifdef LIBC_TYPES_HAS_FLOAT16
|| cpp::is_same_v<float16, XType>
#endif
,
int > = 0 >
cpp::enable_if_t <cpp::is_same_v<float , XType>, int > = 0 >
explicit MPFRNumber (XType x,
unsigned int precision = ExtraPrecision<XType>::VALUE,
RoundingMode rounding = RoundingMode::Nearest)
Expand Down
Expand Up
@@ -543,8 +529,8 @@ class MPFRNumber {
// If the control reaches here, it means that this number and input are
// of the same sign but different exponent. In such a case, ULP error is
// calculated as sum of two parts.
thisAsT = FPBits<T>(thisAsT). abs (). get_val ( );
input = FPBits<T>(input). abs (). get_val ( );
thisAsT = std:: abs (thisAsT );
input = std:: abs (input );
T min = thisAsT > input ? input : thisAsT;
T max = thisAsT > input ? thisAsT : input;
int minExponent = FPBits<T>(min).get_exponent ();
Expand Down
Expand Up
@@ -599,14 +585,6 @@ template <> long double MPFRNumber::as<long double>() const {
return mpfr_get_ld (value, mpfr_rounding);
}
#ifdef LIBC_TYPES_HAS_FLOAT16
template <> float16 MPFRNumber::as<float16>() const {
// TODO: Either prove that this cast won't cause double-rounding errors, or
// find a better way to get a float16.
return static_cast <float16>(mpfr_get_d (value, mpfr_rounding));
}
#endif
namespace internal {
template <typename InputType>
Expand Down
Expand Up
@@ -785,10 +763,6 @@ template void explain_unary_operation_single_output_error<double>(
Operation op, double , double , double , RoundingMode);
template void explain_unary_operation_single_output_error<long double >(
Operation op, long double , long double , double , RoundingMode);
#ifdef LIBC_TYPES_HAS_FLOAT16
template void explain_unary_operation_single_output_error<float16>(
Operation op, float16, float16, double , RoundingMode);
#endif
template <typename T>
void explain_unary_operation_two_outputs_error (
Expand Down
Expand Up
@@ -968,11 +942,6 @@ template bool compare_unary_operation_single_output<double>(Operation, double,
RoundingMode);
template bool compare_unary_operation_single_output<long double >(
Operation, long double , long double , double , RoundingMode);
#ifdef LIBC_TYPES_HAS_FLOAT16
template bool compare_unary_operation_single_output<float16>(Operation, float16,
float16, double ,
RoundingMode);
#endif
template <typename T>
bool compare_unary_operation_two_outputs (Operation op, T input,
Expand Down