double precision function pinorm(x) implicit real*8 (a-h,o-z) c c this function takes an angle (in radians) and puts it in the range of c -pi to +pi. c integer n include 'COMMON.GEO' n = x / dwapi pinorm = x - n * dwapi if ( pinorm .gt. pi ) then pinorm = pinorm - dwapi else if ( pinorm .lt. - pi ) then pinorm = pinorm + dwapi end if return end