# isgn --Calculates sign of (-1)**input-integer # # Description: # ------------ # This function calculates the value of -1 raised to the power of the # input integer without using exponentiation. It is based on the fact # that if the input integer is even, the result will be +1. # # # Version Date Author Description # 27-JAN-1993 R. Williamson Converted to SPP # 2 17-AUG-1983 PAT MURPHY PDL and Fortran code added # 1 17-AUG-1983 PAT MURPHY Prolog Generation int procedure isgn (n) int n,isn # The input exponent begin # Set the result negative isn = -1 # unless the input is even if(int(n/2)*2==n)isn = 1 return (isn) end