# 04 · float-to-int-boundaries **演示**:double 只能精确表示到 `2^53`;`math.tointeger(2^63)` 返回 `nil`;`3.0` 可转整数。 **运行时**:`lua54`。 **运行**: ```sh .tools/bin/lua54 scripts/run-example.lua examples/03-numbers/04-float-to-int-boundaries .tools/bin/lua54 scripts/test-example.lua examples/03-numbers/04-float-to-int-boundaries ``` **预期输出**(lua 5.4.9 / macOS arm64): ```text 2p53_plus_1_collapses=true 2p63_tointeger_nil=true converted=3 max=9223372036854775807 ``` **看点**:JSON/数据库里的 64 位 ID 超过 `2^53` 后,经 double 往返会丢精度。 **注意**:`math.tointeger` 只接受可精确表示的整数值浮点。