; math_acos.asm ; ; MATH_ACOS module. ; ACOS(x)- Computes the arccosine of st(0) ; and leaves the result in st(0). ; Allowable range: -1<=x<=+1 ; There must be at least two free ; FPU registers for this function ; to operate properly. ; ; acos(x) = atan(sqrt(1-x*x)/x)) include math.inc .code math_acos proc fld st(0) ; Duplicate X on tos. fld st(0) ; Duplicate X on tos again fmulp ; Compute X**2. fld1 ; Compute 1-X**2. fsubrp ; Compute: fsqrt ; sqrt(1-X**2). fxch ST(1) ; Swap TOS with NOS fpatan ; fpatan computes ret ; ATAN(ST(1)/ST(0)) math_acos endp end