Skip to main content

checked_pow

Function checked_pow 

Source
pub fn checked_pow(base: u64, exp: u32) -> Result<u64, ProgramError>
Expand description

Checked exponentiation via repeated squaring.

Computes base^exp with overflow checking at each step. Useful for compound interest calculations and exponential decay.

let compound = checked_pow(rate_per_period, num_periods)?;