You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Sagnik Chakraborty (Jira)" <ji...@apache.org> on 2020/10/08 11:47:00 UTC

[jira] [Created] (ARROW-10234) [C++][Gandiva] Fix logic of round() for floats/decimals in Gandiva

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)