1 | 2 | scosh.sa 3.1 12/10/90 3 | 4 | The entry point sCosh computes the hyp 5 | an input argument; sCoshd does the sam 6 | input. 7 | 8 | Input: Double-extended number X in loc 9 | by address register a0. 10 | 11 | Output: The value cosh(X) returned in 12 | 13 | Accuracy and Monotonicity: The returne 14 | 64 significant bit, i.e. withi 15 | result is subsequently rounded 16 | result is provably monotonic i 17 | 18 | Speed: The program sCOSH takes approxi 19 | 20 | Algorithm: 21 | 22 | COSH 23 | 1. If |X| > 16380 log2, go to 3. 24 | 25 | 2. (|X| <= 16380 log2) Cosh(X) is obta 26 | y = |X|, z = exp(Y), and 27 | cosh(X) = (1/2)*( z + 1/z ). 28 | Exit. 29 | 30 | 3. (|X| > 16380 log2). If |X| > 16480 31 | 32 | 4. (16380 log2 < |X| <= 16480 log2) 33 | cosh(X) = sign(X) * exp(|X|)/2 34 | However, invoking exp(|X|) may 35 | Thus, we calculate sinh(X) as 36 | Y := |X| 37 | Fact := 2**(16380) 38 | Y' := Y - 16381 log2 39 | cosh(X) := Fact * exp(Y'). 40 | Exit. 41 | 42 | 5. (|X| > 16480 log2) sinh(X) must ove 43 | Huge*Huge to generate overflow 44 | the appropriate sign. Huge is 45 | extended format. Exit. 46 | 47 | 48 49 | Copyright (C) Motorola, Inc. 1 50 | All Rights Reserved 51 | 52 | For details on the license for this fi 53 | file, README, in this same directory. 54 55 |SCOSH idnt 2,1 | Motorola 040 Floating Po 56 57 |section 8 58 59 |xref t_ovfl 60 |xref t_frcinx 61 |xref setox 62 63 T1: .long 0x40C62D38,0xD3D64634 | ... 1638 64 T2: .long 0x3D6F90AE,0xB1E75CC7 | ... 1638 65 66 TWO16380: .long 0x7FFB0000,0x80000000,0x000000 67 68 .global scoshd 69 scoshd: 70 |--COSH(X) = 1 FOR DENORMALIZED X 71 72 fmoves #0x3F800000,%fp0 73 74 fmovel %d1,%FPCR 75 fadds #0x00800000,%fp0 76 bra t_frcinx 77 78 .global scosh 79 scosh: 80 fmovex (%a0),%fp0 | ...L 81 82 movel (%a0),%d0 83 movew 4(%a0),%d0 84 andil #0x7FFFFFFF,%d0 85 cmpil #0x400CB167,%d0 86 bgts COSHBIG 87 88 |--THIS IS THE USUAL CASE, |X| < 16380 LOG2 89 |--COSH(X) = (1/2) * ( EXP(X) + 1/EXP(X) ) 90 91 fabsx %fp0 | ...| 92 93 movel %d1,-(%sp) 94 clrl %d1 95 fmovemx %fp0-%fp0,(%a0) |pass paramete 96 bsr setox | ...F 97 fmuls #0x3F000000,%fp0 98 movel (%sp)+,%d1 99 100 fmoves #0x3E800000,%fp1 101 fdivx %fp0,%fp1 102 103 fmovel %d1,%FPCR 104 faddx %fp1,%fp0 105 106 bra t_frcinx 107 108 COSHBIG: 109 cmpil #0x400CB2B3,%d0 110 bgts COSHHUGE 111 112 fabsx %fp0 113 fsubd T1(%pc),%fp0 114 fsubd T2(%pc),%fp0 115 116 movel %d1,-(%sp) 117 clrl %d1 118 fmovemx %fp0-%fp0,(%a0) 119 bsr setox 120 fmovel (%sp)+,%fpcr 121 122 fmulx TWO16380(%pc),%fp0 123 bra t_frcinx 124 125 COSHHUGE: 126 fmovel #0,%fpsr 127 bclrb #7,(%a0) 128 fmovemx (%a0),%fp0-%fp0 129 bra t_ovfl 130 131 |end
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.