LN
Git SourceState Variables
M
one
ln2WAD2
ln1point1WAD2
Functions
_compute_sutable_k
Computes the the number of bits needed to shift x to the left to get a value between 0.5 and 1 (WAD**2)| Name | Type | Description |
|---|---|---|
x | uint256 | the number to compute the number of bits needed to shift to the left to get between 0.5 and 1 (WAD**2) |
| Name | Type | Description |
|---|---|---|
<none> | uint256 | k the number of bits needed to shift to the left to get x between 0.5 and 1 (WAD**2) |
_compute_suitable_q
log2(x/(10M)) = - (log2(10M) - log2(x)) where log2(10**M) = 119 _Computes the the number of times that (2 ** k) _ x needs to be multiplied by 1.1 to be as close as possibe to 1 (WAD*2)| Name | Type | Description |
|---|---|---|
new_x | uint256 | defined as (2 *_ k) _ x |
| Name | Type | Description |
|---|---|---|
<none> | uint256 | q the number of times that new_x needs to be multiplied by 1.1 to be as close as possibe to 1 (WAD**2) |
lnWAD2Negative
to properly use the result of this function, multiply by -1, or use as -result Computes the absolute value of the natural log of x where x is a positive number less than 1 and is expressed as a WAD ** 2 (36 decimal places)| Name | Type | Description |
|---|---|---|
x | uint256 | the number to take the natural log of. Expected to be expressed as a WAD ** 2 |
| Name | Type | Description |
|---|---|---|
result | uint256 | the ln of x multiplied by -1. Expressed as a WAD ** 2 |