Fix return value bug that drops minus sign in some cases. (#2415)

* fix return value bug.

* refine change according to comment.

[ROCm/composable_kernel commit: 60eb70f543]
This commit is contained in:
Gino Lu
2025-07-02 14:53:00 +08:00
committed by GitHub
parent dfb7e0d358
commit 5ba3c3edd7

View File

@@ -213,7 +213,7 @@ __host__ __device__ inline T convert_to_type(float value)
{
// closer to 0
if(std::abs(value) <= std::abs(min_subnorm - value))
return 0;
return sign << (NumericUtils<T>::exp + NumericUtils<T>::mant);
else
return 1 | (sign << (NumericUtils<T>::exp + NumericUtils<T>::mant));
}
@@ -249,7 +249,7 @@ __host__ __device__ inline T convert_to_type(float value)
if(out_exponent == 0 && mantissa == 0)
{
return 0;
return sign << (NumericUtils<T>::exp + NumericUtils<T>::mant);
}
mantissa &= (1UL << NumericUtils<T>::mant) - 1;