MTH$COSH        ; Floating Point Hyperbolic Cosine routine       21-AUG-1978 19:02:52   VAX-11 MACRO X0.3-11               Page   0

TABLE OF CONTENTS   



   (2)      91  HISTORY	; Detailed Current Edit History

   (3)     106  DECLARATIONS	; Declarative Part of Module

   (4)     153  MTH$COSH  - Standard Single Precision Floating 

MTH$COSH        ; Floating Point Hyperbolic Cosine routine       21-AUG-1978 19:02:52   VAX-11 MACRO X0.3-11               Page   1

0-4                                                                                                                              (1)



                                     0000     1 	.TITLE	MTH$COSH 	; Floating Point Hyperbolic Cosine routine

                                     0000     2 				; (COSH)

                                     0000     3 	.IDENT /0-4/		; File: MTHCOSH.MAR

                                     0000     4 ;

                                     0000     5 ; Copyright (C) 1977

                                     0000     6 ; Digital Equipment Corporation, Maynard, Massachusetts 01754

                                     0000     7 ;

                                     0000     8 ; This  software  is furnished under a license for use only on a single

                                     0000     9 ; computer  system  and  may  be  copied only with the inclusion of the

                                     0000    10 ; above copyright notice.  This software, or  any other copies thereof,

                                     0000    11 ; may not  be  provided or otherwise made available to any other person

                                     0000    12 ; except  for  use on such system and to one who agree to these license 

                                     0000    13 ; terms.  Title  to  and  ownership of the software shall  at all times 

                                     0000    14 ; remain in DEC.

                                     0000    15 ;

                                     0000    16 ; The information  in  the software is subject to change without notice

                                     0000    17 ; and should  not  be  construed  as  a commitment by Digital Equipment 

                                     0000    18 ; Corporation.

                                     0000    19 ;

                                     0000    20 ; DEC assumes  no  responsibility  for  the use  or  reliability of its

                                     0000    21 ; software on equipment which is not supplied by DEC.

                                     0000    22 ;

                                     0000    23 ;

                                     0000    24 ; FACILITY: MATH LIBRARY

                                     0000    25 ;++

                                     0000    26 ; ABSTRACT:

                                     0000    27 ;

                                     0000    28 ; MTH$COSH is a function  which  returns the floating point hyperbolic cosine

                                     0000    29 ; of its single precision floating point argument. The call is standard

                                     0000    30 ; call-by-reference.

                                     0000    31 ;

                                     0000    32 ;--

                                     0000    33 ;

                                     0000    34 ; VERSION: 01

                                     0000    35 ;

                                     0000    36 ; HISTORY:

                                     0000    37 ; AUTHOR:

                                     0000    38 ;	Peter Yuo, 29-Jun-77: Version 01

                                     0000    39 ;

                                     0000    40 ; MODIFIED BY:

                                     0000    41 ;

                                     0000    42 ;

                                     0000    43 ;

MTH$COSH        ; Floating Point Hyperbolic Cosine routine       21-AUG-1978 19:02:52   VAX-11 MACRO X0.3-11               Page   2

0-4             HISTORY ; Detailed Current Edit History                                                                          (2)



                                     0000    45 	.SBTTL	HISTORY	; Detailed Current Edit History

                                     0000    46 

                                     0000    47 

                                     0000    48 ; ALGORITHMIC DIFFERENCES FROM FP-11/C ROUTINE:	none

                                     0000    49 ;

                                     0000    50 ; Edit History for Version 01 of MTH$COSH 

                                     0000    51 ;

                                     0000    52 ; 0-2	MTH$$ERROR changed to MTH$$SIGNAL.

                                     0000    53 ;	MTH$_... changed to MTH__....

                                     0000    54 ;	Changed error handling mechanism. Put error result in R0 before 

                                     0000    55 ;	calling MTH$$SIGNAL in order to allow user modify error result.

                                     0000    56 ;

                                     0000    57 ;0-3	Series changed from four term Taylor series to four term

                                     0000    58 ;	Chebyshev series, to improve accuracy. 18-May-1978; Mary Payne

MTH$COSH        ; Floating Point Hyperbolic Cosine routine       21-AUG-1978 19:02:52   VAX-11 MACRO X0.3-11               Page   3

0-4             DECLARATIONS ; Declarative Part of Module                                                                        (3)



                                     0000    60 	.SBTTL	DECLARATIONS	; Declarative Part of Module

                                     0000    61 

                                     0000    62 ;

                                     0000    63 ; INCLUDE FILES:	OTSPARAMS.MAR

                                     0000    64 ;

                                     0000    65 ; EXTERNAL SYMBOLS:	MTH$JACKET_HDLR

                                     0000    66 ;

                                     0000    67 ; EQUATED SYMBOLS:

                                     0000    68 

                           00003F80  0000    69 	LF_0.25	= 0@16 + ^X3F80		; 0.25

                           000043AE  0000    70 	LF_87.0	= 0@16 + ^O041656	; 87.0

                           00003B00  0000    71 	LF_2_POWER_M11	= 0@16 + ^X3B00	; 2**-11

                           72184031  0000    72 	LF_LOG_2	= ^O071030@16 + ^O040061

                                     0000    73 					; LOG(2)

                           00004000  0000    74 	SF_0.5	= ^F0.5			; 0.5

                           00004080  0000    75 	SF_1.0	= ^F1.0			; 1.0

                           00000004  0000    76 	value	= 4			; value.rf.r

                                     0000    77 

                                     0000    78 ;

                                     0000    79 ; MACROS:

                                     0000    80 ;

                                     0000    81 

                                     0000    82 	$SRMDEF			; SRM$ symbol definitions

                                     0000    83 

                                     0000    84 

                                     0000    85 ;

                                     0000    86 ;

                                     0000    87 ; PSECT DECLARATIONS:

                                     0000    88 

                                 00000000    89 	.PSECT	MTH$CODE	PIC,SHR,LONG,EXE,NOWRT

                                     0000    90 					; program section for math routines

                                     0000    91 ;

                                     0000    92 ; OWN STORAGE:	none

                                     0000    93 ;

                                     0000    94 ;

                                     0000    95 ; CONSTANTS:

                                     0000    96 ;

                                     0000    97 

                                     0000    98 COSHTAB:

                          7381 3BB6  0000    99 	.WORD	^O035666,^O071601	; DECIMAL: 0.1391992E-02

                          AA8A 3E2A  0004   100 	.WORD	^O37052,^O125212	; DECIMAL: 0.416654E-01

                          0000 4000  0008   101 	.WORD	^O040000,0		; DECIMAL: 0.5000000E+00

                          0000 4080  000C   102 	.WORD	^O040200,0		; DECIMAL: 0.1000000E+01

                                     0010   103   

                           00000004  0010   104 COSHLEN	= .- COSHTAB/4

                                     0010   105 

MTH$COSH        ; Floating Point Hyperbolic Cosine routine       21-AUG-1978 19:02:52   VAX-11 MACRO X0.3-11               Page   4

0-4             MTH$COSH  - Standard Single Precision Floating                                                                   (4)



                                     0010   107 	.SBTTL	MTH$COSH  - Standard Single Precision Floating COSH

                                     0010   108 

                                     0010   109 

                                     0010   110 ;++

                                     0010   111 ; FUNCTIONAL DESCRIPTION:

                                     0010   112 ;

                                     0010   113 ; COSH  - single precision floating point function

                                     0010   114 ;

                                     0010   115 ; COSH(X) is computed as:

                                     0010   116 ;

                                     0010   117 ;	If |X| < 2**-11, COSH(X) = 1.

                                     0010   118 ;	IF 2**-11 =< |X| < 0.25, COSH(X) = Chebyshev series

                                     0010   119 ;	If 0.25 =< |X| =< 87.0, COSH(X) = (EXP(X) + EXP(-X))/2.

                                     0010   120 ;	If 87.0 < |X| and |X| - LOG(2) < 87, then COSH(X) = EXP(|X|-LOG(2)).

                                     0010   121 ;	If 87.0 < |X| and |X| - LOG(2) = 87, then overflow.

                                     0010   122 ;

                                     0010   123 ; CALLING SEQUENCE:

                                     0010   124 ;

                                     0010   125 ;	COSH.wf.v = MTH$COSH(x.rf.r)

                                     0010   126 ;

                                     0010   127 ; INPUT PARAMETERS:

                                     0010   128 

                           00000004  0010   129 	LONG = 4			; define longword multiplier

                           00000004  0010   130 	x = 1 * LONG			; Contents of x is the argument

                                     0010   131 

                                     0010   132 ; IMPLICIT INPUTS:	none

                                     0010   133 ;

                                     0010   134 ; OUTPUT PARAMETERS:

                                     0010   135 ;

                                     0010   136 ;	VALUE:	floating hyperbolic cosine of the argument

                                     0010   137 ;

                                     0010   138 ; IMPLICIT OUTPUTS:	none

                                     0010   139 ;

                                     0010   140 ; COMPLETION CODES:	none

                                     0010   141 ;

                                     0010   142 ; SIDE EFFECTS:

                                     0010   143 ;

                                     0010   144 ; Signal: MTH$_FLOOVEMAT if 87+LOG(2) < |X| with reserved operand in R0

                                     0010   145 ; (copied to the signal mechanism vector CHF$L_MCH_R0/R1 by LIB$SIGNAL).

                                     0010   146 ; Associated message is: "FLOATING OVERFLOW IN MATH LIBRARY". Result is reserved

                                     0010   147 ; operand -0.0 unless a user supplied (or any) error handler changes CHF$L_MCH_R0/R1

                                     0010   148 ;

                                     0010   149 ; NOTE: This procedure disables floating point underflow, enables integer

                                     0010   150 ; overflow.

                                     0010   151 ;

                                     0010   152 ;---

                                     0010   153 

                                     0010   154 

                               403C' 0010   155 	.ENTRY	MTH$COSH, ^M<IV, R2, R3, R4, R5>

                                     0012   156 					; standard call-by-reference entry

                                     0012   157 					; disable DV (and FU), enable IV

                                     0012   158 	MTH$FLAG_JACKET			; flag that this is a jacket procedure in

                                     0012      

            6D       0000'CF     3E  0012       	MOVAW	W^MTH$$JACKET_HND, (FP)

                                     0017       					; set handler address to jacket

                                     0017       					; handler

                                     0017       

MTH$COSH        ; Floating Point Hyperbolic Cosine routine       21-AUG-1978 19:02:52   VAX-11 MACRO X0.3-11               Page   5

0-4             MTH$COSH  - Standard Single Precision Floating                                                                   (4)



                                     0017   159 					; case of an error in routine

                                     0017   160 					; If an error, convert signal to user PC

                                     0017   161 					; and resignal

            55         04 BC     50  0017   162 	MOVF	@value(AP), R5		; R5 = X = @value(AP)

            50            55     50  001B   163 	MOVF	R5, R0

            50       8000 8F     AA  001E   164 	BICW2	#^X8000, R0		; R0 = |X|

       3F80 8F            50     B1  0023   165 	CMPW	R0, #^X3F80		; compare |X| with 0.25

                          14     18  0028   166 	BGEQ	GEQ_TO_0.25		; branch if |X| >= 0.25

                                     002A   167 

                                     002A   168 ;

                                     002A   169 ; |X| < 0.25

                                     002A   170 ;

                                     002A   171 

       3B00 8F            50     B1  002A   172 	CMPW	R0, #^X3B00	; compare |X| with 2**-11

                          04     18  002F   173 	BGEQ	GEQ_TO_2M11		; branch if |X| >= 2**-11

                                     0031   174 

                                     0031   175 ;

                                     0031   176 ; |X| < 2**-11

                                     0031   177 ;

                                     0031   178 

            50            08     50  0031   179 	MOVF	S^#SF_1.0, R0		; R0 = 1.0

                                 04  0034   180 	RET				; return with result = 1.0

                                     0035   181 

                                     0035   182 ;

                                     0035   183 ; 2**-11 =< |X| < 0.25

                                     0035   184 ;

                                     0035   185 

                                     0035   186 GEQ_TO_2M11:

            50            50     44  0035   187 	MULF	R0,R0			;Get ARG**2 for POLYF

            03            50     55  0038   188 	POLYF	R0, #COSHLEN-1, COSHTAB	; R0 = SUM(Ci*X**(2*i))

                       C3 AF         003B       

                                     003D   189 					;  Last coefficient of 1.0

                                     003D   190 					;  provides overhang.

                                 04  003D   191 	RET				; return with result in R0

                                     003E   192 

                                     003E   193 ;

                                     003E   194 ; 0.25 =< |X|

                                     003E   195 ;

                                     003E   196 

                                     003E   197 GEQ_TO_0.25:

   000043AE 8F            50     51  003E   198 	CMPF	R0, #LF_87.0		; compare |X| with 87.0

                          1B     14  0045   199 	BGTR	GTR_THAN_87.0		; branch if |X| > 87.0

                                     0047   200 

                                     0047   201 ;

                                     0047   202 ; 0.25 =< |X| =< 87.0

                                     0047   203 ;

                                     0047   204 

            50            55     50  0047   205 	MOVF	R5, R0		; R0 = X

                 00000000'EF     16  004A   206 	JSB	MTH$EXP_R4		; R0 = EXP(X)

                          50     DD  0050   207 	PUSHL	R0			; push EXP(X) on stack

            50            55     52  0052   208 	MNEGF	R5, R0		; R0 = -X

                 00000000'EF     16  0055   209 	JSB	MTH$EXP_R4		; R0 = EXP(-X)

            50            8E     40  005B   210 	ADDF	(SP)+, R0		; R0 = EXP(X) + EXP(-X)

            50            00     44  005E   211 	MULF	S^#SF_0.5, R0		; R0 = (EXP(X) + EXP(-X))/2

                                 04  0061   212 	RET				; return with result in R0

                                     0062   213 

                                     0062   214 ;

MTH$COSH        ; Floating Point Hyperbolic Cosine routine       21-AUG-1978 19:02:52   VAX-11 MACRO X0.3-11               Page   6

0-4             MTH$COSH  - Standard Single Precision Floating                                                                   (4)



                                     0062   215 ; 87.0 < |X|

                                     0062   216 ;

                                     0062   217 

                                     0062   218 GTR_THAN_87.0:

            50   72184031 8F     42  0062   219 	SUBF	#LF_LOG_2, R0		; R0 = |X| - LOG(2)

   000043AE 8F            50     51  0069   220 	CMPF	R0, #LF_87.0		; compare |X| - LOG(2) with 87.0

                          07     18  0070   221 	BGEQ	ERROR			; branch to ERROR if |X| - LOG(2) >= 87.0

                                     0072   222 

                                     0072   223 

                                     0072   224 ;

                                     0072   225 ; 87.0 < |X| < 87.0 + LOG(2)

                                     0072   226 ;

                                     0072   227 

                 00000000'EF     16  0072   228 	JSB	MTH$EXP_R4		; R0 = EXP(|X|-LOG(2)) = (EXP(X))/2

                                 04  0078   229 	RET				; return with result in R0

                                     0079   230 

                                     0079   231 ;

                                     0079   232 ; 87.0 + LOG(2) =< |X|, error

                                     0079   233 ;

                                     0079   234 

            7E         58 8F     9A  0079   235 ERROR:	MOVZBL	#MTH__FLOOVEMAT, -(SP)	; condition value

            01            0F     78  007D   236 	ASHL	#15, #1, R0		; R0 = result = reserved operand -0.0

                          50         0080       

                                     0081   237 					; goes to signal mechanism vector

                                     0081   238 					; (CHF$L_MCH_R0/R1) so error handler

                                     0081   239 					; can modify the result.

       0000'CF            01     FB  0081   240 	CALLS	#1, W^MTH$$SIGNAL	; signal error and use real user's PC

                                     0086   241 					; independent of CALL vs JSB

                                 04  0086   242 	RET				; return - R0 restored from CHF$L_MCH_R0/R1

                                     0087   243 

                                     0087   244 

                                     0087   245 

                                     0087   246 	.END

MTH$COSH        ; Floating Point Hyperbolic Cosine routine       21-AUG-1978 19:02:52   VAX-11 MACRO X0.3-11               Page   7

SYMBOL TABLE                                                                                                                     (4)



COSHLEN        = 00000004            

COSHTAB          00000000 R     03   

ERROR            00000079 R     03   

FOR$K_ERR_PREFX= 00000018            

GBL...         = 00000000            

GEQ_TO_0.25      0000003E R     03   

GEQ_TO_2M11      00000035 R     03   

GTR_THAN_87.0    00000062 R     03   

LF_0.25        = 00003F80            

LF_2_POWER_M11 = 00003B00            

LF_87.0        = 000043AE            

LF_LOG_2       = 72184031            

LONG           = 00000004            

MTH$$JACKET_HND  ********   X   03   

MTH$$SIGNAL      ********   X   03   

MTH$COSH         00000010 RG    03   

MTH$EXP_R4       ********   X   03   

MTH$K_ERR_PREFX= 00000016            

MTH__FLOOVEMAT = 00000058            

MTH__FLOUNDMAT = 00000059            

MTH__INVARG    = 00000051            

MTH__LOGZERNEG = 00000053            

MTH__SINSIGLOS = 00000057            

MTH__SQUROONEG = 00000054            

MTH__UNDEXP    = 00000052            

MTH__WRONUMARG = 00000050            

SF_0.5         = 00004000            

SF_1.0         = 00004080            

SRM$K_DEC_OVF_T= 00000006            

SRM$K_FLT_DIV_T= 00000004            

SRM$K_FLT_OVF_T= 00000003            

SRM$K_FLT_UND_T= 00000005            

SRM$K_INT_DIV_T= 00000002            

SRM$K_INT_OVF_T= 00000001            

SRM$K_SUB_RNG_T= 00000007            

VALUE          = 00000004            

X              = 00000004            





PROGRAM SECTION SYNOPSIS



.  ABS  .        00000000      00     NOPIC   USR   CON   ABS   LCL NOSHR NOEXE NORD  NOWRT BYTE  

. BLANK .        00000000      01     NOPIC   USR   CON   REL   LCL NOSHR   EXE   RD    WRT BYTE  

$ABS$            00000000      02     NOPIC   USR   CON   ABS   LCL NOSHR   EXE   RD    WRT BYTE  

MTH$CODE         00000087      03       PIC   USR   CON   REL   LCL   SHR   EXE   RD  NOWRT LONG  





THERE WERE NO ERRORS OR WARNINGS.

26920. BYTES LEFT IN FREE MEMORY POOL.

8. BYTES OF RECLAIMED MEMORY.

OBJ$:MTHCOSH,LIS$:MTHCOSH/-SP=LIB$:S/ML,SRC$:P,MTHCOSH

5 MLB DIR RDS - 38 GETS TO DEFINE 5 MACROS. 3 INTER. FILE WRITES. 

