[libc-commits] [libc] [libc][math][c23] Add f16sqrtf C23 math function (PR #95251)

via libc-commits libc-commits at lists.llvm.org
Thu Jun 13 07:42:19 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);
----------------
lntue wrote:

probably you can remove `<input type>` from the all the instantiations if they can be deduced.

https://github.com/llvm/llvm-project/pull/95251


More information about the libc-commits mailing list