Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-10234

[C++][Gandiva] Fix logic of round() for floats/decimals in Gandiva

    XMLWordPrintableJSON

Details

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              sagnikc Sagnik Chakraborty
              sagnikc Sagnik Chakraborty
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h
                  3h