Annotation of coherent/b/lib/libm/i387/asin87.s, revision 1.1.1.1

1.1       root        1: //////////
                      2: / /usr/src/libm/i387/asin87.s
                      3: / i387 mathematics library
                      4: / asin(d)
                      5: //////////
                      6: 
                      7: RASIZE =       4
                      8: 
                      9:        .globl  asin
                     10:        .globl  _asin
                     11:        .globl  _cfcc
                     12:        .globl  _edomain
                     13: 
                     14: //////////
                     15: / double
                     16: / asin(d)
                     17: / double d;
                     18: /
                     19: / _asin() returns asin(%st).
                     20: / It sets the Carry flag iff a domain error occurs.
                     21: //////////
                     22: 
                     23: d      =       RASIZE          / arg offset
                     24: 
                     25: asin:
                     26:        fldl    d(%esp)         / Load argument d.
                     27: 
                     28: _asin:                         / d
                     29:        fld     %st             / d, d
                     30:        fabs                    / abs(d), d
                     31:        fld1                    / 1, abs(d), d
                     32:        fcompp                  / Compare 1 to abs(d) and pop twice.
                     33:        call    _cfcc
                     34:        ja      ?1              / -1 < d < 1, use atan.
                     35:        je      ?0              / d = 1 or d = -1
                     36:        call    _edomain        / d < -1 or 1 < d, issue EDOM error
                     37:        stc                     / and set the Carry flag
                     38:        ret                     / and return.
                     39: 
                     40: ?0:
                     41:        fld1                    / 1, d
                     42:        fchs                    / -1, d
                     43:        fldpi                   / pi, -1, d
                     44:        fscale                  / pi/2, -1, d
                     45:        fstp    %st(1)          / pi/2, d
                     46:        fmul                    / For d = 1 or d = -1, asin(d) = d * pi/2.
                     47:        clc                     / Clear the Carry flag.
                     48:        ret
                     49: 
                     50: ?1:
                     51:        fld     %st             / d, d
                     52:        fmul    %st, %st        / d*d, d
                     53:        fld1                    / 1, d*d, d
                     54:        fsub                    / 1 - d*d, d
                     55:        fsqrt                   / sqrt(1-d*d), d
                     56:        fpatan                  / asin(d) = atan(d/sqrt(1-d*d))
                     57:        clc                     / Clear the Carry flag.
                     58:        ret
                     59: 
                     60: / end of asin87.s

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.