[BUG]fastjson2 2.0.64 使用getBigDecimal存在精度丢失问题
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
fastjson2 2.0.64 使用getBigDecimal存在精度丢失问题
### 环境信息
- OS信息: Mac Tahoe 26.1
- JDK信息:OpenJDK 21.0.7
- 版本信息:2.0.64
### 重现步骤
public static void main(String[] args) {
JSONObject value = new JSONObject().fluentPut("value", 0.00054797);
System.out.println(value.getBigDecimal("value"));
}
输出:0.0005479699999999999,与预期0.00054797不符。
Contributor guide
Research direction
Start by reproducing the example with JSONObject.fluentPut and getBigDecimal on fastjson2 2.0.64, then trace the implementation of those methods to find where the decimal value loses precision. Add a regression test covering 0.00054797 and verify that the returned value matches the expected decimal representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100