Skip to content

fix int to float conversions#108

Merged
hanzei merged 1 commit intostretchr:masterfrom
geseq:fix-floats
Jul 16, 2021
Merged

fix int to float conversions#108
hanzei merged 1 commit intostretchr:masterfrom
geseq:fix-floats

Conversation

@geseq
Copy link
Collaborator

@geseq geseq commented Jul 3, 2021

fixes #101
fixes #99

Due to #59 integer floats are converted to int, causing float check issues. One way to fix is to move float to int conversions to Int() accessor. This has the side effect of also fixing loss of precision. It also makes the implementation consistent with go's json unmarshal

Summary

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • Tests are passing: task test
  • Code style is correct: task lint

@geseq
Copy link
Collaborator Author

geseq commented Jul 3, 2021

looks like this'll require #107 to be merged to fix the CI failure

@hanzei hanzei self-requested a review July 5, 2021 15:24
Copy link
Collaborator

@hanzei hanzei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense 👍

@hanzei hanzei added this to the v1.0 milestone Jul 16, 2021
@hanzei hanzei merged commit 4ff3852 into stretchr:master Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Float conversion behavior issue Automatically converting float to integer loses precision

2 participants