This refactors the FixedPoint type to be generic with implementations for i128, u128, I256, and U256. For the most part, the library can be used the same, but with a type param, eg:
However, the API has been expanded and there's plenty code reduction we can do in future PRs. It's probably also worth rethinking argument types now that the library can support negative numbers and be bound by different limits.
Expanded API
I wrote doc comments throughout to aid in adoption, but below is a skeleton containing most of the new API to get a quick sense:
Related to: #127
(replaces wip pr: #184)
Description
This refactors the
FixedPoint
type to be generic with implementations fori128
,u128
,I256
, andU256
. For the most part, the library can be used the same, but with a type param, eg:However, the API has been expanded and there's plenty code reduction we can do in future PRs. It's probably also worth rethinking argument types now that the library can support negative numbers and be bound by different limits.
Expanded API
I wrote doc comments throughout to aid in adoption, but below is a skeleton containing most of the new API to get a quick sense: