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

Float number rounding up policy? #35

Closed
fangpenlin opened this issue Aug 19, 2013 · 2 comments
Closed

Float number rounding up policy? #35

fangpenlin opened this issue Aug 19, 2013 · 2 comments

Comments

@fangpenlin
Copy link
Contributor

As we are processing money, I think maybe we should be careful with float numbers rounding up issue. Currently, I use

Numeric(10, 2)

for all money fields (also for discount field). I am not sure are two digits float number good enough. Also, we have discount for subscriptions, and we have prorated_refund for canceling a subscription. In this two cases, money amount could be rated. It could be

amount = original_amount * discount * prorated

After all, I have no money processing experience. I have no idea how to process them. Is there anything I should notice? What do youguys think?

@mjallday
Copy link
Contributor

The Balanced API send and receives all money values as integers since everything is represented via cents.

This is an easy way to implement since a cent is the smallest amount of money that can be represented via a transfer. In fact, the minimum amount that can be sent via the Balanced API is 50 cents.

Are there any scenarios where you need to record a fraction of a cent?

@mahmoudimus
Copy link
Contributor

@mjallday he's talking about percentages (like 30% off) - what's the rounding policy? I believe our policy is round down to the nearest cents.

fangpenlin added a commit to fangpenlin/billy that referenced this issue Aug 20, 2013
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

No branches or pull requests

3 participants