aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--reference_model/src/ops/type_conversion.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/reference_model/src/ops/type_conversion.cc b/reference_model/src/ops/type_conversion.cc
index dbedbad..a3140c3 100644
--- a/reference_model/src/ops/type_conversion.cc
+++ b/reference_model/src/ops/type_conversion.cc
@@ -350,7 +350,7 @@ CastHelper<DType_FP16, OutDtype>::CastHelper()
fcn = [](float in) -> OutEigenType {
// Cast from float representation back to half_float before rounding
half_float::half h = half_float::half(in);
- h = std::round(h);
+ h = std::rint(h);
OutEigenType out = half_float::half_cast<OutEigenType, half_float::half>(h);
out = std::max<OutEigenType>(out, OutMin);
out = std::min<OutEigenType>(out, OutMax);
@@ -401,7 +401,7 @@ CastHelper<DType_FP32, OutDtype>::CastHelper()
{
// fp32 data converted to integer
fcn = [](float in) -> OutEigenType {
- OutEigenType out = std::round(in);
+ OutEigenType out = std::rint(in);
out = std::max<OutEigenType>(out, OutMin);
out = std::min<OutEigenType>(out, OutMax);
return out;