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


56.3
date     93.01.27.13.57.23;  author jwh;  state Exp;
branches ;
next     56.2;

56.2
date     93.01.27.12.28.54;  author jwh;  state Exp;
branches ;
next     56.1;

56.1
date     91.11.07.12.30.26;  author jwh;  state Exp;
branches ;
next     1.1;

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


desc
@@


56.3
log
@
pws2rcs automatic delta on Wed Jan 27 13:14:25 MST 1993
@
text
@*
*       slog2.sa 3.1 12/10/90
*
*       The entry point slog10 computes the base-10
*       logarithm of an input argument X.
*       slog10d does the same except the input value is a
*       denormalized number.
*       sLog2 and sLog2d are the base-2 analogues.
*
*       INPUT:  Double-extended value in memory location pointed to
*               by address register a0.
*
*       OUTPUT: log_10(X) or log_2(X) returned in floating-point
*               register fp0.
*
*       ACCURACY and MONOTONICITY: The returned result is within 1.7
*               ulps in 64 significant bit, i.e. within 0.5003 ulp
*               to 53 bits if the result is subsequently rounded
*               to double precision. The result is provably monotonic
*               in double precision.
*
*       SPEED:  Two timings are measured, both in the copy-back mode.
*               The first one is measured when the function is invoked
*               the first time (so the instructions and data are not
*               in cache), and the second one is measured when the
*               function is reinvoked at the same input argument.
*
*       ALGORITHM and IMPLEMENTATION NOTES:
*
*       slog10d:
*
*       Step 0.   If X < 0, create a NaN and raise the invalid operation
*                 flag. Otherwise, save FPCONTROL in D1; set FPCONTROL to default.
*       Notes:    Default means round-to-nearest mode, no floating-point
*                 traps, and precision control = double extended.
*
*       Step 1.   Call slognd to obtain Y = log(X), the natural log of X.
*       Notes:    Even if X is denormalized, log(X) is always normalized.
*
*       Step 2.   Compute log_10(X) = log(X) * (1/log(10)).
*            2.1  Restore the user FPCONTROL
*            2.2  Return ans := Y * INV_L10.
*
*
*       slog10:
*
*       Step 0.   If X < 0, create a NaN and raise the invalid operation
*                 flag. Otherwise, save FPCONTROL in D1; set FPCONTROL to default.
*       Notes:    Default means round-to-nearest mode, no floating-point
*                 traps, and precision control = double extended.
*
*       Step 1.   Call sLogN to obtain Y = log(X), the natural log of X.
*
*       Step 2.   Compute log_10(X) = log(X) * (1/log(10)).
*            2.1  Restore the user FPCONTROL
*            2.2  Return ans := Y * INV_L10.
*
*
*       sLog2d:
*
*       Step 0.   If X < 0, create a NaN and raise the invalid operation
*                 flag. Otherwise, save FPCONTROL in D1; set FPCONTROL to default.
*       Notes:    Default means round-to-nearest mode, no floating-point
*                 traps, and precision control = double extended.
*
*       Step 1.   Call slognd to obtain Y = log(X), the natural log of X.
*       Notes:    Even if X is denormalized, log(X) is always normalized.
*
*       Step 2.   Compute log_10(X) = log(X) * (1/log(2)).
*            2.1  Restore the user FPCONTROL
*            2.2  Return ans := Y * INV_L2.
*
*
*       sLog2:
*
*       Step 0.   If X < 0, create a NaN and raise the invalid operation
*                 flag. Otherwise, save FPCONTROL in D1; set FPCONTROL to default.
*       Notes:    Default means round-to-nearest mode, no floating-point
*                 traps, and precision control = double extended.
*
*       Step 1.   If X is not an integer power of two, i.e., X != 2^k,
*                 go to Step 3.
*
*       Step 2.   Return k.
*            2.1  Get integer k, X = 2^k.
*            2.2  Restore the user FPCONTROL.
*            2.3  Return ans := convert-to-double-extended(k).
*
*       Step 3.   Call sLogN to obtain Y = log(X), the natural log of X.
*
*       Step 4.   Compute log_2(X) = log(X) * (1/log(2)).
*            4.1  Restore the user FPCONTROL
*            4.2  Return ans := Y * INV_L2.
*

*               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_frcinx
	refr    t_operr
	refr    slogn
	refr    slognd

INV_L10  DC.L $3FFD0000,$DE5BD8A9,$37287195,$00000000

INV_L2   DC.L $3FFF0000,$B8AA3B29,$5C17F0BC,$00000000

	def     slog10d
slog10d    equ    *
*--entry point for Log10(X), X is denormalized
	move.l          (a0),d0
	blt.w           invalid
	move.l          d1,-(sp)
	clr.l           d1
	bsr             slognd                  ...log(X), X denorm.
	fmove.l         (sp)+,FPCONTROL
	fmul.x          INV_L10,fp0
	bra             t_frcinx

	def     slog10
slog10    equ    *
*--entry point for Log10(X), X is normalized

	move.l          (a0),d0
	blt.w           invalid
	move.l          d1,-(sp)
	clr.l           d1
	bsr             slogn                   ...log(X), X normal.
	fmove.l         (sp)+,FPCONTROL
	fmul.x          INV_L10,fp0
	bra             t_frcinx


	def     slog2d
slog2d    equ    *
*--entry point for Log2(X), X is denormalized

	move.l          (a0),d0
	blt.w           invalid
	move.l          d1,-(sp)
	clr.l           d1
	bsr             slognd                  ...log(X), X denorm.
	fmove.l         (sp)+,FPCONTROL
	fmul.x          INV_L2,fp0
	bra             t_frcinx

	def     slog2
slog2    equ    *
*--entry point for Log2(X), X is normalized
	move.l          (a0),d0
	blt.w           invalid

	move.l          8(a0),d0
	bne.b           continue                ...X is not 2^k

	move.l          4(a0),d0
	and.l           #$7FFFFFFF,d0
	tst.l           d0
	bne.b           continue

*--X = 2^k.
	move.w          (a0),d0
	and.l           #$00007FFF,d0
	sub.l           #$3FFF,d0
	fmove.l         d1,FPCONTROL
	fmove.l         d0,fp0
	bra             t_frcinx

continue    equ    *
	move.l          d1,-(sp)
	clr.l           d1
	bsr             slogn                   ...log(X), X normal.
	fmove.l         (sp)+,FPCONTROL
	fmul.x          INV_L2,fp0
	bra             t_frcinx

invalid    equ    *
	bra             t_operr

	end
@


56.2
log
@
pws2rcs automatic delta on Wed Jan 27 11:57:27 MST 1993
@
text
@d1 186
@


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@a0 186
*
*       slog2.sa 3.1 12/10/90
*
*       The entry point slog10 computes the base-10
*       logarithm of an input argument X.
*       slog10d does the same except the input value is a
*       denormalized number.
*       sLog2 and sLog2d are the base-2 analogues.
*
*       INPUT:  Double-extended value in memory location pointed to
*               by address register a0.
*
*       OUTPUT: log_10(X) or log_2(X) returned in floating-point
*               register fp0.
*
*       ACCURACY and MONOTONICITY: The returned result is within 1.7
*               ulps in 64 significant bit, i.e. within 0.5003 ulp
*               to 53 bits if the result is subsequently rounded
*               to double precision. The result is provably monotonic
*               in double precision.
*
*       SPEED:  Two timings are measured, both in the copy-back mode.
*               The first one is measured when the function is invoked
*               the first time (so the instructions and data are not
*               in cache), and the second one is measured when the
*               function is reinvoked at the same input argument.
*
*       ALGORITHM and IMPLEMENTATION NOTES:
*
*       slog10d:
*
*       Step 0.   If X < 0, create a NaN and raise the invalid operation
*                 flag. Otherwise, save FPCONTROL in D1; set FPCONTROL to default.
*       Notes:    Default means round-to-nearest mode, no floating-point
*                 traps, and precision control = double extended.
*
*       Step 1.   Call slognd to obtain Y = log(X), the natural log of X.
*       Notes:    Even if X is denormalized, log(X) is always normalized.
*
*       Step 2.   Compute log_10(X) = log(X) * (1/log(10)).
*            2.1  Restore the user FPCONTROL
*            2.2  Return ans := Y * INV_L10.
*
*
*       slog10:
*
*       Step 0.   If X < 0, create a NaN and raise the invalid operation
*                 flag. Otherwise, save FPCONTROL in D1; set FPCONTROL to default.
*       Notes:    Default means round-to-nearest mode, no floating-point
*                 traps, and precision control = double extended.
*
*       Step 1.   Call sLogN to obtain Y = log(X), the natural log of X.
*
*       Step 2.   Compute log_10(X) = log(X) * (1/log(10)).
*            2.1  Restore the user FPCONTROL
*            2.2  Return ans := Y * INV_L10.
*
*
*       sLog2d:
*
*       Step 0.   If X < 0, create a NaN and raise the invalid operation
*                 flag. Otherwise, save FPCONTROL in D1; set FPCONTROL to default.
*       Notes:    Default means round-to-nearest mode, no floating-point
*                 traps, and precision control = double extended.
*
*       Step 1.   Call slognd to obtain Y = log(X), the natural log of X.
*       Notes:    Even if X is denormalized, log(X) is always normalized.
*
*       Step 2.   Compute log_10(X) = log(X) * (1/log(2)).
*            2.1  Restore the user FPCONTROL
*            2.2  Return ans := Y * INV_L2.
*
*
*       sLog2:
*
*       Step 0.   If X < 0, create a NaN and raise the invalid operation
*                 flag. Otherwise, save FPCONTROL in D1; set FPCONTROL to default.
*       Notes:    Default means round-to-nearest mode, no floating-point
*                 traps, and precision control = double extended.
*
*       Step 1.   If X is not an integer power of two, i.e., X != 2^k,
*                 go to Step 3.
*
*       Step 2.   Return k.
*            2.1  Get integer k, X = 2^k.
*            2.2  Restore the user FPCONTROL.
*            2.3  Return ans := convert-to-double-extended(k).
*
*       Step 3.   Call sLogN to obtain Y = log(X), the natural log of X.
*
*       Step 4.   Compute log_2(X) = log(X) * (1/log(2)).
*            4.1  Restore the user FPCONTROL
*            4.2  Return ans := Y * INV_L2.
*

*               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_frcinx
	refr    t_operr
	refr    slogn
	refr    slognd

INV_L10  DC.L $3FFD0000,$DE5BD8A9,$37287195,$00000000

INV_L2   DC.L $3FFF0000,$B8AA3B29,$5C17F0BC,$00000000

	def     slog10d
slog10d    equ    *
*--entry point for Log10(X), X is denormalized
	move.l          (a0),d0
	blt.w           invalid
	move.l          d1,-(sp)
	clr.l           d1
	bsr             slognd                  ...log(X), X denorm.
	fmove.l         (sp)+,FPCONTROL
	fmul.x          INV_L10,fp0
	bra             t_frcinx

	def     slog10
slog10    equ    *
*--entry point for Log10(X), X is normalized

	move.l          (a0),d0
	blt.w           invalid
	move.l          d1,-(sp)
	clr.l           d1
	bsr             slogn                   ...log(X), X normal.
	fmove.l         (sp)+,FPCONTROL
	fmul.x          INV_L10,fp0
	bra             t_frcinx


	def     slog2d
slog2d    equ    *
*--entry point for Log2(X), X is denormalized

	move.l          (a0),d0
	blt.w           invalid
	move.l          d1,-(sp)
	clr.l           d1
	bsr             slognd                  ...log(X), X denorm.
	fmove.l         (sp)+,FPCONTROL
	fmul.x          INV_L2,fp0
	bra             t_frcinx

	def     slog2
slog2    equ    *
*--entry point for Log2(X), X is normalized
	move.l          (a0),d0
	blt.w           invalid

	move.l          8(a0),d0
	bne.b           continue                ...X is not 2^k

	move.l          4(a0),d0
	and.l           #$7FFFFFFF,d0
	tst.l           d0
	bne.b           continue

*--X = 2^k.
	move.w          (a0),d0
	and.l           #$00007FFF,d0
	sub.l           #$3FFF,d0
	fmove.l         d1,FPCONTROL
	fmove.l         d0,fp0
	bra             t_frcinx

continue    equ    *
	move.l          d1,-(sp)
	clr.l           d1
	bsr             slogn                   ...log(X), X normal.
	fmove.l         (sp)+,FPCONTROL
	fmul.x          INV_L2,fp0
	bra             t_frcinx

invalid    equ    *
	bra             t_operr

	end
@


1.1
log
@Initial revision
@
text
@@
