TITLE RANGE - Returns argument within the range of +/- PI/2 SUBTTL Dissassembled from OLD:FORLIB.REL by Joe Smith, 8-Sep-83 ;ANG=RANGE(ANGLE) ! ANG has been reduced to be within -1.57 to +1.57 ENTRY RANGE ;REAL FUNCTION RANGE (ARG) SIXBIT /RANGE/ RANGE: MOVE 0,@(16) ;Get argument MOVE 1,PI%2 ;Get PI/2 for rounding CAIGE 0,0 ;Positive? MOVNS 1 ;No, use -PI/2 FADR 1,0 ;Add in rounding factor FDVR 1,PI ;Divide by PI MOVEM 1,TEMP ;Save quotient for later testing MOVMS 1 ;Absolute value of quotient FAD 1,BIG ;Shift fractional part into oblivion FSB 1,BIG ;Number in AC1 has no fraction SKIPGE TEMP ;If was negative, MOVNS 1 ; change quotient to be negative FMPR 1,PI ;Get multiple of PI FSBR 0,1 ;Return number between -PI/2 and +PI/2 POPJ 17, ;Return from RANGE PI: EXP 202622077325 ;3.141592653 (MACRO is off in the LSB) PI%2: EXP 201622077325 ;PI/2 (1.5707963) BIG: EXP 233400000000 ;Number to drop any fractional part (67108864.0) TEMP: EXP 0 END