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

Fix Quotient function to pass dectests #50

Merged
merged 10 commits into from
Jun 19, 2019
Merged

Conversation

joshcarp
Copy link
Contributor

  • Change Quotient method to pass dectests
  • Pass half up and half even rounding
  • Use type of binary rounding to keep track of remainders

@joshcarp joshcarp requested a review from MichaelDao June 11, 2019 02:29
decimal64decParts.go Outdated Show resolved Hide resolved
decimal64math.go Outdated Show resolved Hide resolved
decimal64math.go Outdated Show resolved Hide resolved
return infinities[sign]
dp.matchSignificandDigits(&ep)
ans.exp = dp.exp - ep.exp
for {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the idea is that there's no way of knowing how much precision the answer will take up in the final answer Without using binary long division. Here we are doing long division, but we keep adjusting the exponent (and the significand) by multiplying it by 10 until we get to the point where we've filled up our precision, then the remainder is rounded. Other methods of division cannot be used because truncation occurs without notice

Copy link
Contributor

@MichaelDao MichaelDao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me

@joshcarp joshcarp requested a review from anzdaddy June 18, 2019 04:07
@joshcarp joshcarp merged commit 050f679 into anz-bank:master Jun 19, 2019
@joshcarp joshcarp deleted the Quotient branch June 19, 2019 03:16
@joshcarp joshcarp mentioned this pull request Jun 21, 2019
joshcarp added a commit to joshcarp/decimal that referenced this pull request Sep 1, 2019
* Add matchsignificand size function

* Add first Implementation of Quo

* Quo function with some rounding

* Add context for quo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants