logoalt Hacker News

lawlorinoyesterday at 2:44 PM3 repliesview on HN

> I consider running from “amounts as integer” systems these days (but usually unfortunately can’t).

In the context of Fintech, how do you otherwise resolve floating point rounding issues if not representing amounts with integers?


Replies

dgunayyesterday at 10:03 PM

All of the data we control (in the database, in our apis, etc) is integer cents. When we have to interface with a system that represents money using JSON numbers as dollars.cents, we parse or serialize it into an arbitrary precision decimal type. Hasn't been much of a problem.

lxgryesterday at 2:57 PM

Native decimal types, if your system has them. Many languages and databases used in financial contexts do.

show 1 reply
simpsondyesterday at 3:41 PM

An integer for the value (scaled by number of decimals) and an integer value for the number of decimals. Different systems may use different values, even for the same currency or asset.

show 1 reply