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

Potentially inaccurate results in crowdsale participation with indivisible tokens #248

Closed
dexX7 opened this issue Sep 19, 2015 · 0 comments

Comments

@dexX7
Copy link
Member

dexX7 commented Sep 19, 2015

CMPTransaction::logicHelper_CrowdsaleParticipation:

if (!isPropertyDivisible(property)) { // <-- the tokens "invested"
    nValue = nValue * 1e8; // <-- 1e8 is floating
}

There is a difference between:

nValue * 100000000

And:

nValue * 1e8

It looks like 1e8 represents a floating point number.

A few examples:

 23058430093 * 100000000 =  2305843009300000000
 23058430093 * 1e8       =  2305843009299999744 // invalid

 46116860184 * 100000000 =  4611686018400000000
 46116860184 * 1e8       =  4611686018300000256 // invalid

184467440735 * 100000000 = 18446744073500000000
184467440735 * 1e8       = 18446744073500000256 // invalid

This issue is related to #247 and might be fixed on one go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant