jiangjiangtian opened a new issue, #6827:
URL: https://github.com/apache/incubator-gluten/issues/6827

   ### Backend
   
   VL (Velox)
   
   ### Bug description
   
   SQL:
   ```
   SELECT round(cast(0.5549999999999999 as double), 2);
   ```
   Gluten returns 0.56, but vanilla spark returns 0.55.
   The reason of this mismatch is that the result of 
std::nextafter(0.5549999999999999) is 0.55500000000000005, which make 
std::round return 56.
   Besides, the following SQL also can't produce the result result in gluten:
   ```
   SELECT round(cast(0.19324999999999998 as double), 2);
   ```
   Gluten returns 0.1933, spark returns 0.1922.
   
   I have tried the following modification in round:
   ```
   return static_cast<TNum>(std::round(std::nextafter(static_cast<long 
double>(number), kInf) * factor) / factor);
   ```
   I can fix the first example, but the second example still has a mismatch.
   The modification will cause the other mismatch:
   ```
   SELECT round(cast(0.575 as double), 2);
   ```
   Before the modification, gluten returns the right result, which is 0.58. 
After the modification, glutens returns 0.57.
   
   ### Spark version
   
   None
   
   ### Spark configurations
   
   _No response_
   
   ### System information
   
   _No response_
   
   ### Relevant logs
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to