Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: 额外参数处理时,使用oj.Parse 造成数据有误差 #182

Open
Mr-TianLang opened this issue Dec 26, 2024 · 2 comments
Open
Assignees

Comments

@Mr-TianLang
Copy link

Current Behavior

代码如下:
func Test_oj(t *testing.T) {
num1 := 1.56930

m := map[string]interface{}{
	"data": num1,
}
jsonStr, _ := json.Marshal(m)
var obj interface{}
json.Unmarshal([]byte(jsonStr), &obj)
fmt.Println(obj)

}

Expected Behavior

期望 obj[data] 得到的数是 1.56930,但是实际的到的是 1.5693000000000001,升级ojg到最新版本也有这个问题。

Error Logs

No response

Steps to Reproduce

请按照上面代码进行debug查看

Environment

  • APINTO 1.15.2
  • go 1.22
@Mr-TianLang
Copy link
Author

请将 github.com/ohler55/ojg 升级到 v1.25.1 版本来解决这个问题

@Dot-Liu
Copy link
Collaborator

Dot-Liu commented Dec 27, 2024

十分感谢!!

@Dot-Liu Dot-Liu self-assigned this Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants