News for hackers. Stuff that matters.
Re:Understanding Ethereum Smart Contracts by aquadrop on Wednesday November 29, 2017 @10:30AM (#15807496)
You might need to work with fractions of "atomic values" to get the desired level of accuracy. So you have to store not logical cents, but 1/100th of cents or something like that. Much easier and straightforward just use decimal-like type.
Re:Understanding Ethereum Smart Contracts by mbrock on Wednesday November 29, 2017 @05:12PM (#15811379)
That's what happens in e.g. the Maker stablecoin project. Decimal fixed point to give sub-wei precision when prorating per-second compounding fees. Other than the normal simple arithmetic operations, we use "exponentiation by squaring" to take a decimal fixed point raised to an integer power.
Re:Understanding Ethereum Smart Contracts by jackpeterfletch on Wednesday November 29, 2017 @12:18PM (#15808641)
Yep, when doing financial stuff, those half cents can count.