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

Incorrect binary representation conversion on large numbers #635

Open
Jigglypuffed opened this issue Dec 19, 2024 · 2 comments
Open

Incorrect binary representation conversion on large numbers #635

Jigglypuffed opened this issue Dec 19, 2024 · 2 comments

Comments

@Jigglypuffed
Copy link
Contributor

Hi, I was experimenting with bitwise operations but quickly ran into a problem.
The numbers are implemented as Rust's f64, which causes conversion performed on large numbers to give surprising results.
For example:

X ← °⋯[⍥1 64]
X  # Expected: 18446744073709551615
⋯X # Expected: 64 1s
⧻. # Expected: 64
18446744073709552000
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1]
65
@kaikalii
Copy link
Member

I'm not sure there is a good solution to this.
I could make it error if precision would be lost, but is that desirable?

@Jigglypuffed
Copy link
Contributor Author

I think until a good solution is found, if any—this behavior should be documented for now.

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