Skip to content

Numerical precision #74

@jrhea

Description

@jrhea

Deeper look into some issues related to numerical precision. PR #73 fixes some issues where an fixed rate purchase results in the APR going up; however, there are still some minor issues where a trade of size 10e18 results in a higher APR than a trade of size 1e18.

    trade size: 10e18
    with divDown: 49999999999886067
    with divUp: 49999996900228853
    delta: 49999999999886067 - 49999996900228853 = 3099657200
    trade size: 1e18
    with divDown: 50000006551536041
    with divUp: 49999975554963707
    delta: 50000006551536041 - 49999975554963707 = 30996572304
    trade size: 0.1e18
    with divDown: 50000057980327600
    with divUp: 49999762774876600
    delta: 50000057980327600 - 49999762774876600 = 295205451000
    trade size: 0.01e18
    with divDown: 50000583700909500
    with divUp: 49997631646399300
    delta: 50000583700909500 - 49997631646399300 = 2952054510208

Metadata

Metadata

Assignees

Labels

contractsRequires smart contract engineering

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions