head     1.0;
access   ;
symbols  ;
locks    ; strict;
comment  @*   @;


1.0
date     89.09.05.22.21.32;  author bryce;  state Exp;
branches ;
next     ;


desc
@Documentation recovered from the depths of Rob Peck's SUN.
@


1.0
log
@added to rcs
@
text
@

TABLE OF CONTENTS

amiga.lib/math/afp
amiga.lib/math/arnd
amiga.lib/math/dbf
amiga.lib/math/fpa
amiga.lib/math/fpbcd


amiga.lib/math/afp                                           amiga.lib/math/afp

   NAME
	afp - Convert ASCII string variable into fast floating point

   USAGE
       ffp_value = afp(string);

    FUNCTION
	Accepts the address of the ASCII string in C format that is
	converted into an FFP floating point number.
	
	The string is expected in this Format:
	{S}{digits}{'.'}{digits}{'E'}{S}{digits}
	<*******MANTISSA*******><***EXPONENT***>
	
	
	Syntax rules:
	Both signs are optional and are '+' or '-'. The mantissa must be
	present. The exponent need not be present. The mantissa may lead
	with a decimal point. The mantissa need not have a decimal point.
	Examples: All of these values represent the number fourty-two.
	             42            .042e3
	             42.          +.042e+03
	            +42.          0.000042e6
	        0000042.00       420000e-4
	                     420000.00e-0004
	
	Floating point range:
	Fast floating point supports the value zero and non-zero values
	within the following bounds -
	                18                             20
	 9.22337177 x 10   > +number >  5.42101070 x 10
	                18                             -20
	-9.22337177 x 10   > -number > -2.71050535 x 10
	 
	Precision:
	This conversion results in a 24 bit precision with guaranteed
	error less than or equal to one-half least significant bit.
	 
	INPUTS
	string - Pointer to the ASCII string to be converted.
	 
	 
	OUTPUTS
	string - points to the character which terminated the scan
	equ - fast floating point equivalent

amiga.lib/math/arnd                                         amiga.lib/math/arnd

  NAME
	arnd - ASCII round of the provided floating point string

   USAGE
	arnd(place, exp, &string[0]);

   FUNCTION
	Accepts an ASCII string representing an FFP floating point
	number, the binary representation of the exponent of said
	floating point number and the number of places to round to.
	A rounding process is initiated, either to the left or right
	of the decimal place and the result placed back at the
	input address defined by &string[0].

   INPUTS
	place - integer representing number of decimal places to round to
	exp - integer representing exponent value of the ASCII string
	&string[0] - address where rounded ASCII string is to be placed
		     (16 bytes)

   RESULT
	&string[0] - rounded ASCII string

   BUGS
	None

amiga.lib/math/dbf                                           amiga.lib/math/dbf

   NAME
	dbf - convert FFP dual-binary number to FFP format

   USAGE
	fnum = dbf(exp, mant);

   FUNCTION
	Accepts a dual-binary format (described below) floating point
	number and converts it to an FFP format floating point number.
	The dual-binary format is defined as:

		exp bit  16     = sign (0=>positive, 1=>negative)
		exp bits 15-0   = binary integer representing the base
					  ten (10) exponent
		man             = binary integer mantissa

   INPUTS
	exp - binary integer representing sign and exponent
	mant - binary integer representing the mantissa

   RESULT
	fnum - converted FFP floating point format number
 
   BUGS
	None

amiga.lib/math/fpa                                           amiga.lib/math/fpa

   NAME
	fpa - convert fast floating point into ASCII string equivalent

   USAGE
	exp = fpa(fnum, &string[0]);

   FUNCTION
	Accepts an FFP number and the address of the ASCII string where it's
	onverted output is to be stored.  The number is converted to a NULL
	terminated ASCII string in and stored at the address provided.
	Additionally, the base ten (10) exponent in binary form is returned.

   INPUTS
	fnum	   - Motorola Fast Floating Point number
	&string[0] - address for output of converted ASCII character string
		     (16 bytes)

   RESULT
	&string[0] - converted ASCII character string
	exp        - integer exponent value in binary form
 
   BUGS
	None

amiga.lib/math/fpbcd                                       amiga.lib/math/fpbcd

   NAME
	fpbcd - convert FFP floating point number to BCD format

   USAGE
	fpbcd(fnum, &string[0]);

   FUNCTION
	Accepts a floating point number and the address where the
	converted BCD data is to be stored.  The FFP number is
	converted and stored at the specified address in an ASCII
	form in accordance with the following format:

		MMMM S E S B

	Where:	M = Four bytes of BCD, each with two (2) digits of
		    the mantissa (8 digits)
		S = Sign of mantissa (0x00 = positive, 0xFF = negative)
		E = BCD byte for two (2) digit exponent
		S = Sign of exponent (0x00 = positive, 0xFF = negative)
		B = One (1) byte binary two's compliment representation
			of the exponent

   INPUTS
	fnum - floating point number
	&string[0] - address where converted BCD data is to be placed

   RESULT
	&string[0] - converted BCD data

@
