Mikhail Vladimirov
1 min readMay 23, 2019

--

The author of the library is here regarding 2⁶⁴ limitation.

While numbers above 2⁶⁴ cannot be directly represented as 64.64-bit fixed point, this does not mean that the library cannot work reliably with large token and ether amounts. Actually, working with arbitrary large token and ether amounts was among the main goals for the library design.

The idea is that money amount are not fractional when measured in basic units, so one need not and should not use fractional data types for them at all. Though, there are use cases when fractional math needs to be applied to money amounts. We found that most of such use cases could be reduced to the following two scenarios:

  1. Calculate fractional coefficient and multiply money amount by it producing another money amount. This covers interest rates, fees, margins, etc.
  2. Divide one money amount by another producing fractional number. This covers exchange rates, Bancor like protocols, etc.

The library has functions specifically designed for these two scenarios: “muli” and “mulu” for the former, “divi” and “divu” for the latter.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Responses (1)

Write a response