safe_pow Function

public elemental function safe_pow(base, exponent) result(y)

Non-integer exponent only. For integer exponents (a**2, a**3, …), write the multiplication out — the compiler unrolls those and they’re already deterministic. Plain elemental inline around the intrinsic; see safe_exp and the module docstring.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: base
real(kind=wp), intent(in) :: exponent

Return Value real(kind=wp)


Source Code

   elemental function safe_pow(base, exponent) result(y)
      !! Non-integer exponent only.  For integer exponents
      !! (`a**2`, `a**3`, ...), write the multiplication out — the
      !! compiler unrolls those and they're already deterministic.
      !! Plain elemental inline around the intrinsic; see `safe_exp`
      !! and the module docstring.
      real(wp), intent(in) :: base
      real(wp), intent(in) :: exponent
      real(wp) :: y
      y = base**exponent
   end function safe_pow