let rec pow_aux n p acc =
  if p = 0 then 1.
  else if p = 1 then acc
  else pow_aux n (p-1) (n *. acc)

let pow n p =
  pow_aux n p n