Unverified50% confidenceDecision RuleExact time
When billing by token, amounts should not be represented with floating point, because float64 cannot exactly represent decimal fractions in binary and the error accumulates and amplifies across millions of rows of data; the author uses Postgres NUMERIC, integer micro-units on the hot path, and decides the rounding level explicitly.
1
Sources
50%
Confidence
Long-term
Relevance
10/14/2026
First Seen
Sources
Related Entities
Related Claims
UnverifiedIEEE 754 double-precision floating point (float64) can only exactly represent fractions whose denominator is a power of 2, and decimal fractions like 0.1 and 0.2 are infinite repeating fractions in binary, so they are necessarily truncated when stored.74% similarUnverified大模型每个数字都是逐 token 生成的,而非逐位计算,导致其算术能力在小数、除法、多步混合运算上不稳定70% similarUnverified如果流式响应计费实现有误,将每个 chunk 携带的累计 Token 数当作增量叠加,会产生等差数列求和 n(n+1)/2 的放大效应67% similarVerifiedFloating-point addition does not satisfy the associative law; (a+b)+c and a+(b+c) may yield different results under floating-point precision.66% similarUnverified浮点运算不满足结合律,不同线程束的执行顺序差异会导致数值结果出现细微偏差65% similar
Cite This Claim
Stable URI
https://kongchang.com/claim/1025409API
curl https://kongchang.com/api/v1/knowledge/claims/1025409MCP
get_claim(id=1025409)