Returns with precautions to avoid overflow.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | a | |||
real(kind=wp), | intent(in) | :: | b |
pure function d2norm( a, b ) real(wp) :: d2norm real(wp),intent(in) :: a real(wp),intent(in) :: b real(wp) :: scale scale = abs( a ) + abs( b ) if (scale == zero) then d2norm = zero else d2norm = scale * sqrt( (a/scale)**2 + (b/scale)**2 ) end if end function d2norm