hifi icon indicating copy to clipboard operation
hifi copied to clipboard

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

Open PaulRBerg opened this issue 2 years ago • 1 comments

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 avatar Jan 31 '22 20:01 PaulRBerg

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.

PaulRBerg avatar Jan 31 '22 20:01 PaulRBerg