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

gconv: The type conversion does not meet expectations #3918

Closed
tianhendi opened this issue Nov 13, 2024 · 1 comment · Fixed by #3920
Closed

gconv: The type conversion does not meet expectations #3918

tianhendi opened this issue Nov 13, 2024 · 1 comment · Fixed by #3920
Labels
bug It is confirmed a bug, but don't worry, we'll handle it.

Comments

@tianhendi
Copy link

Go version

go 1.22.6 windows/amd

GoFrame version

2.7.4

Can this bug be reproduced with the latest release?

Option Yes

What did you do?

微信图片_20241113151519

What did you see happen?

浮点数类型的负数字符串,在执行类型转换后,负数变正了

What did you expect to see?

能正常转换正负浮点数

@tianhendi tianhendi added the bug It is confirmed a bug, but don't worry, we'll handle it. label Nov 13, 2024
@tianhendi tianhendi changed the title os/gtime: issue title gconv: The type conversion does not meet expectations Nov 13, 2024
@UncleChair
Copy link
Contributor

@gqcn Found the float was not using minus in string

isMinus = false

gf/util/gconv/gconv_int.go

Lines 125 to 129 in 8c6db24

if valueInt64 := Float64(s); math.IsNaN(valueInt64) {
return 0
} else {
return int64(valueInt64)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It is confirmed a bug, but don't worry, we'll handle it.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants