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

Lossy Conversion of Units #67

Open
AmeanAsad opened this issue Jun 3, 2023 · 1 comment
Open

Lossy Conversion of Units #67

AmeanAsad opened this issue Jun 3, 2023 · 1 comment

Comments

@AmeanAsad
Copy link
Contributor

Description:

Deploying payouts from a csv requires a conversion of an f64 (in attofil units) -> u128 -> U256 value. This conversion becomes lossy for an f64 value >= 50000000000000000000000 (50,000 FIL * 10^18 ).

Example:
Converting 50000000000000000000000 from f64 to u128 in rust yields: 49999999999999995805696.

This means that in the case an earning is placed > 50,000 FIL the conversion will have a margin of error.

@AmeanAsad
Copy link
Contributor Author

A potential solution is to just store the values in the CSV as attofil units and convert to u128 directly. We already have attofil entries for our payout accounting. That way we avoid the lossy conversion from f64 -> u128

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

1 participant