logoalt Hacker News

microgptyesterday at 1:33 PM4 repliesview on HN

Customer was charged $0.995 after fees, how to represent in your data model with integer cents?


Replies

lxgryesterday at 3:10 PM

You'll have to decide when and how to round. Keeping individual billing items at high precision and rounding after summing them up can work; defining and documenting a rounding policy (or complying with whatever's legally required in your jurisdiction/domain) and rounding each individual billed item can as well.

snsnsjjsjsiisayesterday at 4:38 PM

You use 1/1000th or 1/10000th or whatever you need. You do not need “cents”.

denismenaceyesterday at 6:23 PM

Currency: USD Amount: 99500 Decimals: 5

xprnioyesterday at 2:20 PM

Round it up

show 1 reply