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% similarUnverifiedIf streaming response billing is implemented incorrectly—treating the cumulative token count carried in each chunk as an incremental addition—it produces an arithmetic series summation amplification effect of 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% similarUnverifiedFloating-point operations do not satisfy the associative law, and differences in execution order among thread warps can lead to subtle numerical deviations in results.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)