mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-14 02:02:46 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user