[libc-commits] [libc] [libc][math][c23] Add f16sqrtf C23 math function (PR #95251)
via libc-commits
libc-commits at lists.llvm.org
Wed Jun 12 08:34:39 PDT 2024
================
@@ -790,37 +796,10 @@ template void explain_unary_operation_single_output_error<long double>(
#ifdef LIBC_TYPES_HAS_FLOAT16
template void explain_unary_operation_single_output_error<float16>(
Operation op, float16, float16, double, RoundingMode);
-#endif
-
-template <typename OutType, typename InType>
-void explain_unary_narrower_operation_single_output_error(
- Operation op, InType input, OutType matchValue, double ulp_tolerance,
- RoundingMode rounding) {
- unsigned int precision = get_precision<InType>(ulp_tolerance);
- MPFRNumber mpfrInput(input, precision);
- MPFRNumber mpfr_result;
- mpfr_result = unary_operation(op, input, precision, rounding);
- MPFRNumber mpfrMatchValue(matchValue);
- cpp::array<char, 4096> msg_data;
- cpp::StringStream msg(msg_data);
- msg << "Match value not within tolerance value of MPFR result:\n"
- << " Input decimal: " << mpfrInput.str() << '\n';
- msg << " Input bits: " << str(FPBits<InType>(input)) << '\n';
- msg << '\n' << " Match decimal: " << mpfrMatchValue.str() << '\n';
- msg << " Match bits: " << str(FPBits<OutType>(matchValue)) << '\n';
- msg << '\n' << " MPFR result: " << mpfr_result.str() << '\n';
- msg << " MPFR rounded: " << str(FPBits<OutType>(mpfr_result.as<OutType>()))
- << '\n';
- msg << '\n';
- msg << " ULP error: " << mpfr_result.ulp_as_mpfr_number(matchValue).str()
- << '\n';
- tlog << msg.str();
-}
-
-#ifdef LIBC_TYPES_HAS_FLOAT16
-template void
-explain_unary_narrower_operation_single_output_error<float16, float>(
- Operation op, float, float16, double, RoundingMode);
+template void explain_unary_operation_single_output_error<float>(Operation op,
+ float, float16,
+ double,
+ RoundingMode);
----------------
overmighty wrote:
The `<float>` part can be deduced, so I don't know if I should leave it as is, or only change it to `<float, float16>` here, or also change it to `<float16, float16>`, etc, elsewhere, or remove the explicit parameters everywhere and let the compiler deduce them.
https://github.com/llvm/llvm-project/pull/95251
More information about the libc-commits
mailing list