1*4882a593Smuzhiyun| 2*4882a593Smuzhiyun| satanh.sa 3.3 12/19/90 3*4882a593Smuzhiyun| 4*4882a593Smuzhiyun| The entry point satanh computes the inverse 5*4882a593Smuzhiyun| hyperbolic tangent of 6*4882a593Smuzhiyun| an input argument; satanhd does the same except for denormalized 7*4882a593Smuzhiyun| input. 8*4882a593Smuzhiyun| 9*4882a593Smuzhiyun| Input: Double-extended number X in location pointed to 10*4882a593Smuzhiyun| by address register a0. 11*4882a593Smuzhiyun| 12*4882a593Smuzhiyun| Output: The value arctanh(X) returned in floating-point register Fp0. 13*4882a593Smuzhiyun| 14*4882a593Smuzhiyun| Accuracy and Monotonicity: The returned result is within 3 ulps in 15*4882a593Smuzhiyun| 64 significant bit, i.e. within 0.5001 ulp to 53 bits if the 16*4882a593Smuzhiyun| result is subsequently rounded to double precision. The 17*4882a593Smuzhiyun| result is provably monotonic in double precision. 18*4882a593Smuzhiyun| 19*4882a593Smuzhiyun| Speed: The program satanh takes approximately 270 cycles. 20*4882a593Smuzhiyun| 21*4882a593Smuzhiyun| Algorithm: 22*4882a593Smuzhiyun| 23*4882a593Smuzhiyun| ATANH 24*4882a593Smuzhiyun| 1. If |X| >= 1, go to 3. 25*4882a593Smuzhiyun| 26*4882a593Smuzhiyun| 2. (|X| < 1) Calculate atanh(X) by 27*4882a593Smuzhiyun| sgn := sign(X) 28*4882a593Smuzhiyun| y := |X| 29*4882a593Smuzhiyun| z := 2y/(1-y) 30*4882a593Smuzhiyun| atanh(X) := sgn * (1/2) * logp1(z) 31*4882a593Smuzhiyun| Exit. 32*4882a593Smuzhiyun| 33*4882a593Smuzhiyun| 3. If |X| > 1, go to 5. 34*4882a593Smuzhiyun| 35*4882a593Smuzhiyun| 4. (|X| = 1) Generate infinity with an appropriate sign and 36*4882a593Smuzhiyun| divide-by-zero by 37*4882a593Smuzhiyun| sgn := sign(X) 38*4882a593Smuzhiyun| atan(X) := sgn / (+0). 39*4882a593Smuzhiyun| Exit. 40*4882a593Smuzhiyun| 41*4882a593Smuzhiyun| 5. (|X| > 1) Generate an invalid operation by 0 * infinity. 42*4882a593Smuzhiyun| Exit. 43*4882a593Smuzhiyun| 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun| Copyright (C) Motorola, Inc. 1990 46*4882a593Smuzhiyun| All Rights Reserved 47*4882a593Smuzhiyun| 48*4882a593Smuzhiyun| For details on the license for this file, please see the 49*4882a593Smuzhiyun| file, README, in this same directory. 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun|satanh idnt 2,1 | Motorola 040 Floating Point Software Package 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun |section 8 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun |xref t_dz 56*4882a593Smuzhiyun |xref t_operr 57*4882a593Smuzhiyun |xref t_frcinx 58*4882a593Smuzhiyun |xref t_extdnrm 59*4882a593Smuzhiyun |xref slognp1 60*4882a593Smuzhiyun 61*4882a593Smuzhiyun .global satanhd 62*4882a593Smuzhiyunsatanhd: 63*4882a593Smuzhiyun|--ATANH(X) = X FOR DENORMALIZED X 64*4882a593Smuzhiyun 65*4882a593Smuzhiyun bra t_extdnrm 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun .global satanh 68*4882a593Smuzhiyunsatanh: 69*4882a593Smuzhiyun movel (%a0),%d0 70*4882a593Smuzhiyun movew 4(%a0),%d0 71*4882a593Smuzhiyun andil #0x7FFFFFFF,%d0 72*4882a593Smuzhiyun cmpil #0x3FFF8000,%d0 73*4882a593Smuzhiyun bges ATANHBIG 74*4882a593Smuzhiyun 75*4882a593Smuzhiyun|--THIS IS THE USUAL CASE, |X| < 1 76*4882a593Smuzhiyun|--Y = |X|, Z = 2Y/(1-Y), ATANH(X) = SIGN(X) * (1/2) * LOG1P(Z). 77*4882a593Smuzhiyun 78*4882a593Smuzhiyun fabsx (%a0),%fp0 | ...Y = |X| 79*4882a593Smuzhiyun fmovex %fp0,%fp1 80*4882a593Smuzhiyun fnegx %fp1 | ...-Y 81*4882a593Smuzhiyun faddx %fp0,%fp0 | ...2Y 82*4882a593Smuzhiyun fadds #0x3F800000,%fp1 | ...1-Y 83*4882a593Smuzhiyun fdivx %fp1,%fp0 | ...2Y/(1-Y) 84*4882a593Smuzhiyun movel (%a0),%d0 85*4882a593Smuzhiyun andil #0x80000000,%d0 86*4882a593Smuzhiyun oril #0x3F000000,%d0 | ...SIGN(X)*HALF 87*4882a593Smuzhiyun movel %d0,-(%sp) 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun fmovemx %fp0-%fp0,(%a0) | ...overwrite input 90*4882a593Smuzhiyun movel %d1,-(%sp) 91*4882a593Smuzhiyun clrl %d1 92*4882a593Smuzhiyun bsr slognp1 | ...LOG1P(Z) 93*4882a593Smuzhiyun fmovel (%sp)+,%fpcr 94*4882a593Smuzhiyun fmuls (%sp)+,%fp0 95*4882a593Smuzhiyun bra t_frcinx 96*4882a593Smuzhiyun 97*4882a593SmuzhiyunATANHBIG: 98*4882a593Smuzhiyun fabsx (%a0),%fp0 | ...|X| 99*4882a593Smuzhiyun fcmps #0x3F800000,%fp0 100*4882a593Smuzhiyun fbgt t_operr 101*4882a593Smuzhiyun bra t_dz 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun |end 104