Cube root of a number (real solution only).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | x |
pure elemental function cube_root(x) result(y) use numbers_module, only: one,three implicit none real(wp),intent(in) :: x real(wp) :: y real(wp),parameter :: one_third = one/three y = sign( abs(x) ** one_third , x ) end function cube_root