Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
kingkonz1
· 5y ago · 0 comments
What better alternative is there for handling currencies? Multiplying the original amount by 100 and casting to an int? ($3.50 -> 350)?
Comments
[–]
danaliv
5y ago
Use ints. No multiplication necessary. Everything is done in cents. You add/remove the decimal point when doing string conversions.
[–]
fiedzia
5y ago
Use decimal type for that