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

glam crate is giving corrupt number when serialized via serde #547

Closed
cybersoulK opened this issue Jun 3, 2022 · 2 comments · Fixed by #549
Closed

glam crate is giving corrupt number when serialized via serde #547

cybersoulK opened this issue Jun 3, 2022 · 2 comments · Fixed by #549

Comments

@cybersoulK
Copy link

cybersoulK commented Jun 3, 2022

bincode 1.3.3 is fine
bincode2 (forked) is fine

image

first value is original,
second is bind code 1.3.3 or bincode2,
third is bincode v.2

the third value can output NaN sometimes.

I tried different settings in the config. and I tried to serialize my own struct of floats, and it works.
no idea why it doesn't work for glam::Vec3

serde is latest version, tried with multiple versions.
serde has field default-features = false

serde::encode_to_vec
serde::decode_from_slice

are side to side and there are no other factors involved

@VictorKoenders
Copy link
Contributor

Make sure you use the right config for both encoding and decoding. There is a migration guide that explains everything.

If this doesn't solve your issue please provide a minimal reproduction example.

@cybersoulK
Copy link
Author

cybersoulK commented Jun 3, 2022

minimal reproduction
https://github.com/cybersoulK/test_bincode

output: Instance { position: Vec3(2.0, 2.0, 2.0) }, Instance { position: Vec3(4e-45, 9e-44, 9e-44) }
machine: Mac m1 pro

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

Successfully merging a pull request may close this issue.

2 participants