Hacker News new | ask | show | jobs
by scott_w 382 days ago
Fixed point Decimal is your friend here. I’m guessing you buy tokens in increments of 1,000,000 so it isn’t too much of an issue to account for. You can then normalise in your accounting so 1,000,000 is just “1 unit,” or you can just account in increments of 1,000,000 but that does start looking weird (but might be necessary!)
1 comments

No, billing happens per-token. It’s entirely necessary to use billionths of a dollar here, if you don’t use floating point.
In which case, I’d look at this thread https://news.ycombinator.com/item?id=44145263