|
|

分享源码
| 界面截图: |
- |
| 是否带模块: |
纯源码 |
| 备注说明: |
- |
更新:数值到文本最短表示
新增:文本到数值,支持流式解析
=== FTOA Test Suite ===
=== Test d_to_s ===
[PASS] 0.0 -> '0'
[PASS] -0.0 -> '0'
[PASS] pi -> '3.141592653589793'
[PASS] -pi -> '-3.141592653589793'
[PASS] 1e20 round-trip
[PASS] 0.000001 round-trip
[PASS] 1.23e-10 -> '1.23e-10'
[PASS] inf -> 'inf'
[PASS] -inf -> '-inf'
[PASS] nan -> 'nan'
=== Test s_to_d_bits ===
[PASS] '3.14' -> 3.14
[PASS] '-3.14' -> -3.14
[PASS] '+3.14' -> 3.14
[PASS] '12345' -> 12345
[PASS] '1.5e10' -> 1.5e10
[PASS] '1.5e-10' -> 1.5e-10
[PASS] '0003.14' -> 3.14
[PASS] 'inf' -> inf
[PASS] '-inf' -> -inf
[PASS] 'nan' -> nan
[PASS] 'abc' -> 0 (invalid)
[PASS] '' -> 0 (empty)
=== Test consume parameter ===
[PASS] '3.14' consumed=4
[PASS] '-3.14' consumed=5
[PASS] '3.14,next' consumed=4
[PASS] '-inf' consumed=4
[PASS] 'abc' consumed=0 (fail)
=== Test round-trip ===
[PASS] 0 -> '0' -> 0
[PASS] 1 -> '1' -> 1
[PASS] -1 -> '-1' -> -1
[PASS] 3.1415926535897931 -> '3.141592653589793' -> 3.1415926535897931
[PASS] -3.1415926535897931 -> '-3.141592653589793' -> -3.1415926535897931
[PASS] 1e+20 -> '1e20' -> 1e+20
[PASS] 9.9999999999999995e-21 -> '1e-20' -> 9.9999999999999995e-21
[PASS] 123.456 -> '123.456' -> 123.456
[PASS] -123.456 -> '-123.456' -> -123.456
[PASS] 999999999999999 -> '999999999999999' -> 999999999999999
=== Test Complete ===
|
评分
-
查看全部评分
|