News for hackers. Stuff that matters.
Re:Beware of Fast-Math by scott_w on Saturday May 31, 2025 @10:40AM (#44144584)
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!)
Re:Beware of Fast-Math by Filligree on Saturday May 31, 2025 @12:47PM (#44145463)
No, billing happens per-token. It’s entirely necessary to use billionths of a dollar here, if you don’t use floating point.
Re:Beware of Fast-Math by scott_w on Saturday May 31, 2025 @04:08PM (#44146664)
In which case, I’d look at this thread https://news.ycombinator.com/item?id=44145263