Skip to content
New issue

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

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

Already on GitHub? # to your account

Disable rounding for float conversion #2337

Merged
merged 4 commits into from
Nov 6, 2024
Merged

Disable rounding for float conversion #2337

merged 4 commits into from
Nov 6, 2024

Conversation

rachitnigam
Copy link
Contributor

@rachitnigam rachitnigam commented Nov 5, 2024

Fixes #2336. Currently running into the same problem as #2335 (comment)

@ekiwi how did you fix it on the Rust side?

@rachitnigam
Copy link
Contributor Author

I am currently getting this output:

{
  "inp": [
    15.123900413513184
  ],
  "out": [
    15.123900413513184,
    0.5600000023841858
  ]
}

Which might be fine since that is the closest representable number from the input files? Thoughts @ekiwi?

@ekiwi
Copy link
Contributor

ekiwi commented Nov 6, 2024

how did you fix it on the Rust side?

I fixed it by printing out the f32 instead of the f64

@ekiwi
Copy link
Contributor

ekiwi commented Nov 6, 2024

Stackoverflow seems to suggest using numpy to work with single precision float. However, it is still unclear to me whether numpy can actually print 32-bit floats.

https://stackoverflow.com/questions/2232362/correct-way-to-emulate-single-precision-floating-point-in-python

@rachitnigam rachitnigam marked this pull request as ready for review November 6, 2024 03:05
@rachitnigam rachitnigam requested a review from ekiwi November 6, 2024 03:06
Copy link
Contributor

@ekiwi ekiwi left a comment

Choose a reason for hiding this comment

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

Awesome. Thanks! :shipit:

@ekiwi ekiwi merged commit f44cf8f into main Nov 6, 2024
18 checks passed
@ekiwi ekiwi deleted the float-val branch November 6, 2024 14:02
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Floating-point conversion error
2 participants