Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Fundamentally, the problem of representing money as Integers is division. A set of integers is not closed over division and, as mathematicians would put it, set of Integers does not form a field. For example, 10/3 is not an integer. Making fundamental money unit small does not solve the problem, it simply limits the size of rounding error. Division followed by multiplication can amplify the rounding errors.

A clean solution would be to use rational numbers of the form y/x stored as a pair of 64-bit numbers. It takes the same 128-bits space as in TigerBeetle proposal but has advantage of exact arithmetic with no rounding errors.

EDIT: typos




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: