Cube root computed accurately, by incorporating one Newton-Raphson iteration.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | x |
pure function dcubrt(x) result(c) implicit none real(wp) :: c real(wp),intent(in) :: x real(wp) :: y if (x==zero) then c = zero else y = abs(x) c = y**athird c = c - athird*(c - y/c**2) c = sign(c,x) end if end function dcubrt