Sagnik Chakraborty created ARROW-10234:
------------------------------------------
Summary: [C++][Gandiva] Fix logic of round() for floats/decimals
in Gandiva
Key: ARROW-10234
URL: https://issues.apache.org/jira/browse/ARROW-10234
Project: Apache Arrow
Issue Type: Bug
Components: C++ - Gandiva
Reporter: Sagnik Chakraborty
Assignee: Sagnik Chakraborty
round() for floats/doubles is returning incorrect results for some edge cases,
like round(cast(1.55 as float), 1) gives 1.6, but it should be 1.5, since the
result after casting to float comes to 1.5499999523162842, due to inaccurate
representation of floating point numbers in memory. Removing an intermediate
explicit cast to float statement for a double value, which is used in
subsequent computations, minimises the error introduced due to the incorrect
representation.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)