Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change TRUNC implementation to use MathX #193

Closed
wants to merge 1 commit into from
Closed

Change TRUNC implementation to use MathX #193

wants to merge 1 commit into from

Conversation

jacobharris919
Copy link

The TRUNC implementation is still broken. (BUG: https://bz.apache.org/bugzilla/show_bug.cgi?id=62506 )

  1. Bug 62506 reports that TRUNC(0.29, 2) = 0.28
  2. The solution proposed in that bugfix still fails for some calculations (see test case)

The main argument against the proposed fix in 62506 was the performance hit of using BigDecimal for every round() operation. Since the round() methods now use MathX methods which construct a BigDecimal from the Excel string, the TRUNC function can be fixed by using the MathX.roundDown() method.

Use MathX.roundDown, which constructs a BigDecimal
from the Excel string, rather than direct double
arithmetic
@asfgit asfgit closed this in dd9f132 Oct 20, 2020
@pjfanning
Copy link
Contributor

Merged with dd9f132 - thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants