Compile float64 functions on CPU (#2311)

This commit is contained in:
Awni Hannun
2025-06-24 10:18:52 -07:00
committed by GitHub
parent 5adf185f86
commit 81bb9a2a9e
4 changed files with 24 additions and 2 deletions

View File

@@ -18,8 +18,12 @@ std::string get_type_string(Dtype d);
template <typename T>
void print_float_constant(std::ostream& os, const array& x) {
auto old_precision = os.precision();
os << std::setprecision(std::numeric_limits<float>::digits10 + 1)
<< x.item<T>() << std::setprecision(old_precision);
if constexpr (std::is_same_v<T, double>) {
os << std::setprecision(std::numeric_limits<double>::digits10 + 1);
} else {
os << std::setprecision(std::numeric_limits<float>::digits10 + 1);
}
os << x.item<T>() << std::setprecision(old_precision);
}
template <typename T>