Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a "pow" function with a normalization factor to stave off overflow when time to maturity is large #73

Open
PaulRBerg opened this issue Jan 31, 2022 · 1 comment
Labels
enhancement Improvement for an existing feature or system package:amm

Comments

@PaulRBerg
Copy link
Contributor

A "pow" function with a normalization factor would joggle with the numbers in such a way that it staves off overflows when the time to maturity is large.

See Yield's pow function, this PDF document:

And this algorithm explanation:

pow-function-with-normalization-factor

@PaulRBerg PaulRBerg added the enhancement Improvement for an existing feature or system label Jan 31, 2022
@PaulRBerg
Copy link
Contributor Author

The catch is that PRBMath, unlike YieldMath, used 256 bits to represent the operands. I'm not sure if this is a show-stopper, in the sense that we can't implement a normalization factor like Yield does for 128 bits numbers.

I guess that in our case we should set f to 2^256-1 but I'm not sure yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement for an existing feature or system package:amm
Projects
None yet
Development

No branches or pull requests

1 participant