Alberto Cuesta Cañada
1 min readMay 24, 2019

--

Hi Mikhail, thanks for your feedback. It took me a while to understand the concept but now I think I get it.

  • Token amounts should always be represented in uint256, and not in the 64.64-bit fixed point.
  • ABDK.Math provides methods like mulu, that takes a uint256 and a 64.64-bit fixed point number and multiplies them, returning a uint256.
  • Multiplying a token amount by a decimal number is done with mulu, with the returned value being a token amount in uint256. This covers case 1 of most financial applications.
  • The other scenario is dividing a money amount by another, divu takes two uint256 and returns a 64.64-bit fixed point.

You are absolutely right, although there is a limitation on the numbers that can’t be represented in 64.64-bit fixed point, that bears no relationship to the characteristics of the tokens involved, since tokens are always represented in uint256.

--

--

Alberto Cuesta Cañada
Alberto Cuesta Cañada

Written by Alberto Cuesta Cañada

Blockchain Architect | Distributed and High Performance Computing Expert | Chaotic and Complex Systems Fanboy

Responses (1)