head     56.1;
access   ;
symbols  ;
locks    ; strict;
comment  @# @;


56.1
date     91.11.05.09.33.39;  author jwh;  state Exp;
branches ;
next     55.1;

55.1
date     91.08.25.10.11.59;  author jwh;  state Exp;
branches ;
next     54.2;

54.2
date     91.08.21.14.38.55;  author jwh;  state Exp;
branches ;
next     54.1;

54.1
date     91.03.18.15.19.04;  author jwh;  state Exp;
branches ;
next     53.1;

53.1
date     91.03.11.19.20.06;  author jwh;  state Exp;
branches ;
next     52.1;

52.1
date     91.02.19.09.04.38;  author jwh;  state Exp;
branches ;
next     51.1;

51.1
date     91.01.30.16.03.50;  author jwh;  state Exp;
branches ;
next     1.1;

1.1
date     91.01.16.16.24.18;  author jwh;  state Exp;
branches ;
next     ;


desc
@first version.
@


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@@


55.1
log
@Automatic bump of revision number for PWS version 3.25A
@
text
@@


54.2
log
@
pws2rcs automatic delta on Wed Aug 21 13:42:03 MDT 1991
@
text
@@


54.1
log
@Automatic bump of revision number for PWS version 3.24
@
text
@a0 142
*
*       scosh.sa 3.1 12/10/90
*
*       The entry point sCosh computes the hyperbolic cosine of
*       an input argument; sCoshd does the same except for denormalized
*       input.
*
*       Input: Double-extended number X in location pointed to
*               by address register a0.
*
*       Output: The value cosh(X) returned in floating-point register Fp0.
*
*       Accuracy and Monotonicity: The returned result is within 3 ulps in
*               64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
*               result is subsequently rounded to double precision. The
*               result is provably monotonic in double precision.
*
*       Speed: The program sCOSH takes approximately 250 cycles.
*
*       Algorithm:
*
*       COSH
*       1. If |X| > 16380 log2, go to 3.
*
*       2. (|X| <= 16380 log2) Cosh(X) is obtained by the formulae
*               y = |X|, z = exp(Y), and
*               cosh(X) = (1/2)*( z + 1/z ).
*               Exit.
*
*       3. (|X| > 16380 log2). If |X| > 16480 log2, go to 5.
*
*       4. (16380 log2 < |X| <= 16480 log2)
*               cosh(X) = sign(X) * exp(|X|)/2.
*               However, invoking exp(|X|) may cause premature overflow.
*               Thus, we calculate sinh(X) as follows:
*               Y       := |X|
*               Fact    :=      2**(16380)
*               Y'      := Y - 16381 log2
*               cosh(X) := Fact * exp(Y').
*               Exit.
*
*       5. (|X| > 16480 log2) sinh(X) must overflow. Return
*               Huge*Huge to generate overflow and an infinity with
*               the appropriate sign. Huge is the largest finite number in
*               extended format. Exit.
*
*

*               Copyright (C) Motorola, Inc. 1990
*                       All Rights Reserved
*
*       THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
*       The copyright notice above does not evidence any
*       actual or intended publication of such source code.



	refr    t_ovfl
	refr    t_frcinx
	refr    setox

* these values added to replace single-precision floating point immediates
* JWH 1/9/91.

V00800000  DC.L $00800000
V3E800000  DC.L $3E800000
V3F800000  DC.L $3F800000
V3F000000  DC.L $3F000000

T1      DC.L $40C62D38,$D3D64634 ... 16381 LOG2 LEAD
T2      DC.L $3D6F90AE,$B1E75CC7 ... 16381 LOG2 TRAIL

TWO16380 DC.L $7FFB0000,$80000000,$00000000,$00000000

	def     scoshd
scoshd    equ    *
*--COSH(X) = 1 FOR DENORMALIZED X

*       FMOVE.S         #:3F800000,FP0
	FMOVE.s         V3F800000,FP0

	FMOVE.L         d1,FPCONTROL
*       FADD.S          #:00800000,FP0
	FADD.S          V00800000,FP0
	bra             t_frcinx

	def     scosh
scosh    equ    *
	FMOVE.X         (a0),FP0        ...LOAD INPUT

	move.l          (a0),d0
	move.w          4(a0),d0
	ANDI.L          #$7FFFFFFF,d0
	CMPI.L          #$400CB167,d0
	BGT.B           COSHBIG

*--THIS IS THE USUAL CASE, |X| < 16380 LOG2
*--COSH(X) = (1/2) * ( EXP(X) + 1/EXP(X) )

	FABS.X          FP0             ...|X|

	move.l          d1,-(sp)
	clr.l           d1
	fmovem.x        fp0,(a0)        ;pass parameter to setox
	bsr             setox           ...FP0 IS EXP(|X|)
*       FMUL.S          #:3F000000,FP0  ...(1/2)EXP(|X|)
	FMUL.S          V3F000000,FP0   ...(1/2)EXP(|X|)
	move.l          (sp)+,d1

*       FMOVE.S         #:3E800000,FP1  ...(1/4)
	FMOVE.S         V3E800000,FP1   ...(1/4)
	FDIV.X          FP0,FP1         ...1/(2 EXP(|X|))

	FMOVE.L         d1,FPCONTROL
	FADD.X          fp1,FP0

	bra             t_frcinx

COSHBIG    equ    *
	CMPI.L          #$400CB2B3,d0
	BGT.B           COSHHUGE

	FABS.X          FP0
	FSUB.D          T1,FP0          ...(|X|-16381LOG2_LEAD)
	FSUB.D          T2,FP0          ...|X| - 16381 LOG2, ACCURATE

	move.l          d1,-(sp)
	clr.l           d1
	fmovem.x        fp0,(a0)
	bsr             setox
	fmove.l         (sp)+,FPCONTROL

	FMUL.X          TWO16380,FP0
	bra             t_frcinx

COSHHUGE    equ    *
	fmove.l         #0,FPSTATUS             ;clr N bit if set by source
	bclr            #7,(a0)         ;always return positive value
	fmovem.x        (a0),fp0
	bra             t_ovfl

	end
@


53.1
log
@Automatic bump of revision number for PWS version 3.24B
@
text
@@


52.1
log
@Automatic bump of revision number for PWS version 3.24A
@
text
@@


51.1
log
@Automatic bump of revision number for PWS version 3.24d
@
text
@@


1.1
log
@Initial revision
@
text
@@
