; math_asec.asm ; ; Assembly language source for the arc secant ; function: include math.inc include aoalib.inc ; ASEC(x)- Computes the arcsecant of st(0) ; and leaves the result in st(0). ; abs(X) must be greater than or equal ; to one. ; There must be at least two free registers ; for this function to operate properly. ; ; asec(x) = atan(sqrt(x*x-1)) .const .code math_asec proc fld st(0) ; Compute x*x fmulp fld1 ; Compute x*x-1 fsubp fldz fcomip st(0), st(1) ;Is (x*x-1) <= 0? jae badAsec fsqrt ; Compute sqrt(x*x-1) fld1 fpatan ; Compute atan of above. ret badAsec: fstp st(0) ;Pop junk off stack fld math_nan ;Return non-a-number ret math_asec endp end