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

Different decimals of floats after JSON serialization #31

Closed
platfowner opened this issue Oct 25, 2023 · 3 comments
Closed

Different decimals of floats after JSON serialization #31

platfowner opened this issue Oct 25, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@platfowner
Copy link
Member

platfowner commented Oct 25, 2023

  • javascript:
    {"gas_price":0,"nonce":-1,"operation":{"is_global":false,"ref":"/transfer/0x09A0d53FDf1c36A131938eb379b98910e55EEfe1/0xbA58D93edD8343C001eC5f43E620712Ba8C10813/-Nh_Na-GOlQGmp3-UILA/value","type":"SET_VALUE","value":0.000001},"timestamp":1698213027857}

  • python:
    {"gas_price":0,"nonce":-1,"operation":{"is_global":false,"ref":"/transfer/0x09A0d53FDf1c36A131938eb379b98910e55EEfe1/0xbA58D93edD8343C001eC5f43E620712Ba8C10813/-Nh_Ox3mmy08Hu8cnlvl/value","type":"SET_VALUE","value":1e-06},"timestamp":1698213384499}

This happens for numbers with exponent 5 or 6:

  • 0.00001 vs. 1e-05
  • 0.000001 vs. 1e-06
  • 0.000012 vs. 1.2e-05
  • 0.0000012 vs. 1.2e-06

Related issues:

@platfowner platfowner self-assigned this Oct 25, 2023
@platfowner platfowner added the bug Something isn't working label Oct 25, 2023
@platfowner
Copy link
Member Author

@platfowner platfowner changed the title Different json serialization for floating point numbers Different decimals of floats after JSON serialization Oct 30, 2023
@platfowner
Copy link
Member Author

Resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant