# Fixed-Point Arithmetic for Rate Computation

To compute base reward rate, base exchange rate, validator-specific exchange rates, and total validator voting power, we need to carefully perform arithmetic to avoid issues with precision and rounding. We use explicitly specified fixed-precision arithmetic for this, with a precision of 8 digits. This allows outputs to fit in a u64, with all products fitting in the output and plenty of headroom for additions.

All integer values should be interpreted as unsigned 64-bit integers, with the exception of the validator’s commission rate, which is a u16 specified in terms of basis points (one one-hundredth of a percent, or in other words, an implicit denominator of ). All integer values, with the exception of the validator’s commission rate, have an implicit denominator of .

Throughout this spec representations are referred to as , where , and the value represented by representations is .

As an example, let’s take a starting value represented in our scheme (so, ) and compute its product with , also represented by our fixed point scheme, so . The product is computed as

Since both and are both representations and both have a factor of , computing their product includes an extra factor of 10^8 which we divide out. All representations are u64 in our scheme, and any fixed-point number or product of fixed point numbers with 8 digits fits well within 64 bits.

### Summary of Notation

• : the fixed-point representation of the base rate at epoch .
• : the fixed-point representation of the base exchange rate at epoch .
• : the funding rate of the validator’s funding stream at index and epoch , in basis points.
• : the sum of the validator’s commission rates, in basis points.
• : the fixed-point representation of the validator-specific reward rate for validator at epoch .
• : the fixed-point representation of the validator-specific exchange rate for validator at epoch .
• : the sum of the tokens in the validator’s delegation pool.
• : the validator’s voting power for validator at epoch .

## Base Reward Rate

The base reward is an input to the protocol, and the exact details of how this base rate is determined is not yet decided. For now, we can assume it is derived from the block header.

## Base Exchange Rate

The base exchange rate, , can be safely computed as follows:

## Commission Rate from Funding Streams

To compute the validator’s commission rate from its set of funding streams, compute

where is the rate of validator ’s -th funding stream at epoch .

## Validator Reward Rate

To compute the validator’s base reward rate, we compute the following:

## Validator Exchange Rate

To compute the validator’s exchange rate, we use the same formula as for the base exchange rate, but substitute the validator-specific reward rate in place of the base reward rate:

## Validator Voting Power

Finally, to compute the validator’s voting power, take: