@database "mathffp"
@master "AMIDEV:NDK/Autodocs/mathffp.doc"

@Node Main "mathffp.doc"
@toc "Autodocs/AG/INDEX/Main"
    @{" SPAbs() " Link "SPAbs()"}
    @{" SPAdd() " Link "SPAdd()"}
    @{" SPCeil() " Link "SPCeil()"}
    @{" SPCmp() " Link "SPCmp()"}
    @{" SPDiv() " Link "SPDiv()"}
    @{" SPFix() " Link "SPFix()"}
    @{" SPFloor() " Link "SPFloor()"}
    @{" SPFlt() " Link "SPFlt()"}
    @{" SPMul() " Link "SPMul()"}
    @{" SPNeg() " Link "SPNeg()"}
    @{" SPSub() " Link "SPSub()"}
    @{" SPTst() " Link "SPTst()"}
@EndNode

@Node "SPAbs()" "mathffp.library/SPAbs"

@{b}   NAME@{ub}
	 SPAbs -- Obtain the absolute value of the fast floating point number.

@{b}   SYNOPSIS@{ub}
	 fnum2 = SPAbs(fnum1)
	 D0	       D0

	 float SPAbs(float fnum1);

@{b}   FUNCTION@{ub}
	 Accepts a floating point number and returns the absolute value of
	 said number.

@{b}   INPUTS@{ub}
	 fnum1 	 - floating point number.

@{b}   RESULT@{ub}
	 fnum2 	 - floating point absolute value of fnum1.

@{b}   BUGS@{ub}
	 None

@{b}   SEE ALSO@{ub}

@EndNode

@Node "SPAdd()" "mathffp.library/SPAdd"

@{b}   NAME@{ub}
	 SPAdd -- Add two floating point numbers.

@{b}   SYNOPSIS@{ub}
	 fnum3 = SPAdd(fnum1, fnum2)
	 D0	            D1     D0

	 float SPAdd(float fnum1, float fnum2);

@{b}   FUNCTION@{ub}
	 Accepts two floating point numbers and returns the arithmetic
	 sum of said numbers.

@{b}   INPUTS@{ub}
	 fnum1 	 - floating point number to add.
	 fnum2 	 - other floating point number to add.

@{b}   RESULT@{ub}
	 fnum3 	 - floating point number, sum of fnum1 and fnum2.

@{b}   BUGS@{ub}
	 None.

@{b}   SEE ALSO@{ub}

@EndNode

@Node "SPCeil()" "mathffp.library/SPCeil"

@{b}   NAME@{ub}
	 SPCeil -- Compute Ceil function of a number.

@{b}   SYNOPSIS@{ub}
	 x = SPCeil(y)
	 D0         D0

	 float SPCeil(float y);

@{b}   FUNCTION@{ub}
	 Calculate the least integer greater than or equal to x and return it.
	 This identity is true.  Ceil(x) = -Floor(-x).

@{b}   INPUTS@{ub}
	 y 	 - Motorola Fast Floating Point @{"Format" Link "dos/Format()"} Number.

@{b}   RESULT@{ub}
	 x 	 - Motorola Fast Floating Point @{"Format" Link "dos/Format()"} Number.

@{b}   BUGS@{ub}
	 None.

@{b}   SEE ALSO@{ub}
	 @{"SPFloor()" Link "SPFloor()"}

@EndNode

@Node "SPCmp()" "mathffp.library/SPCmp"

@{b}   NAME@{ub}
	 SPCmp -- Compares two floating point numbers.

@{b}   SYNOPSIS@{ub}
	 result = SPCmp(fnum1, fnum2)
	 D0               D1     D0

	 int SPCmp(float fnum1, float fnum2);

@{b}   FUNCTION@{ub}
	 Accepts two floating point numbers and returns the condition
	 codes set to indicate the result of said comparison.  Additionally,
	 the integer functional result is returned to indicate the result
	 of said comparison.

@{b}   INPUTS@{ub}
	 fnum1 	 - floating point number.
	 fnum2 	 - floating point number.

@{b}   RESULT@{ub}
	 Condition codes set to reflect the following branches:

		GT - fnum2 >  fnum1
		GE - fnum2 >= fnum1
		EQ - fnum2 =  fnum1
		NE - fnum2 != fnum1
		LT - fnum2 <  fnum1
		LE - fnum2 <= fnum1

	 Integer functional result as:

		+1 => fnum1 > fnum2
		-1 => fnum1 < fnum2
		 0 => fnum1 = fnum2

@{b}   BUGS@{ub}
	 The return value in the condition codes is REALLY the inverse of the
	 result signalled in D0.

	 Unlike what former documentations said, this function expects fnum1
	 in D1 not in D0, and fnum2 in D0, not D1, similar to all other
	 mathffp functions.  This has always been like it, and it will not
	 change in the future. Earlier autodocs were incorrect. Note that the
	 ".fd" files are correct, i.e.  compiler prototypes are correct.

	 This has the following consequences: If compared with the IEEE
	 libraries, which expect the first argument in the lower, not higher
	 registers, the result as returned in the condition codes is as if
	 you compare D0 with D1, consistently throughout all math models,
	 including this function, FFP and IEEE math.  If you look, however,
	 at the argument position as function call from C, the condition
	 codes are exactly the inverse as one would expect. Luckely, if
	 called explicitly as a C function from C code, the condition codes
	 are not reachable and hence irrelevant.

	 Because the return value in D0 is the inverse of the condition
	 codes, unlike IEEE math, the return value in D0 reflects the
	 comparison of the first argument with the second (+1 if first
	 argument > second), but because the first argument is in D1, this is
	 the inverse of the IEEE return result if looked at the register
	 allocation, but the same argument if looked at the argument
	 position.  Hence, again, if called explicitly from C, the result is
	 consistent with that of of IEEE math, but just because the register
	 allocation is the inverse.


@{b}   SEE ALSO@{ub}

@EndNode

@Node "SPDiv()" "mathffp.library/SPDiv"

@{b}   NAME@{ub}
	 SPDiv -- Divide two floating point numbers.

@{b}   SYNOPSIS@{ub}
	 fnum3 = SPDiv(fnum1, fnum2)
	 D0	            D1     D0

	 float SPDiv(float fnum1, float fnum2);

@{b}   FUNCTION@{ub}
	 Accepts two floating point numbers and returns the quotient
	 of the second argument divided by the first.

@{b}   INPUTS@{ub}
	 fnum1 	 - floating point number.
	 fnum2	 - floating point number.

@{b}   RESULT@{ub}
	 fnum3 	 - floating point number.

@{b}   BUGS@{ub}
 	 Former autodocs did not document which register is the divisor
 	 and which the divident. The divisor is the first argument, in
 	 register D1, the divident is the second argument in D0.
 	 Note that the register allocation is identical to that of the
 	 IEEE math functions, but the order of the function arguments
 	 is exactly the inverse of IEEE.
 	 Former releases crashed with a divide-by-zero exception if
 	 the divisor was zero. This release returns the largest positive
 	 or negative number, depending on the signs of the arguments.
 	 Unfortunately, this also holds for the divison of 0 by 0.

@{b}   SEE ALSO@{ub}

@EndNode

@Node "SPFix()" "mathffp.library/SPFix"

@{b}   NAME@{ub}
	 SPFix -- Convert fast floating point number to integer.

@{b}   SYNOPSIS@{ub}
	 inum = SPFix(fnum)
	 D0	           D0

	 int SPFix(float fnum);

@{b}   FUNCTION@{ub}
	 Accepts a floating point number and returns the truncated
	 integer portion of said number.

@{b}   INPUTS@{ub}
	 fnum 	 - floating point number.

@{b}   RESULT@{ub}
	 inum 	 - signed integer number.

@{b}   BUGS@{ub}
	 None.

@{b}   SEE ALSO@{ub}

@EndNode

@Node "SPFloor()" "mathffp.library/SPFloor"

@{b}   NAME@{ub}
	 SPFloor -- compute Floor function of a number.

@{b}   SYNOPSIS@{ub}
	 x = SPFloor(y)
	 D0      D0

	 float SPFloor(float y);

@{b}   FUNCTION@{ub}
	 Calculate the largest integer less than or equal to x and return it.

@{b}   INPUTS@{ub}
	 y 	 - Motorola Fast Floating Point number.

@{b}   RESULT@{ub}
	 x 	 - Motorola Fast Floating Point number.

@{b}   BUGS@{ub}
	 None.

@{b}   SEE ALSO@{ub}
	 @{"SPCeil()" Link "SPCeil()"}

@EndNode

@Node "SPFlt()" "mathffp.library/SPFlt"

@{b}   NAME@{ub}
	 SPFlt -- Convert integer number to fast floating point.

@{b}   SYNOPSIS@{ub}
	 fnum = SPFlt(inum)
	 D0	           D0

	 float SPFlt(inet inum);

@{b}   FUNCTION@{ub}
	 Accepts an integer and returns the converted
	 floating point result of said number.

@{b}   INPUTS@{ub}
	 inum 	 - signed integer number

@{b}   RESULT@{ub}
	 fnum 	 - floating point number

@{b}   BUGS@{ub}
	 None.

@{b}   SEE ALSO@{ub}

@EndNode

@Node "SPMul()" "mathffp.library/SPMul"

@{b}   NAME@{ub}
	 SPMul -- Multiply two floating point numbers.

@{b}   SYNOPSIS@{ub}
	 fnum3 = SPMul(fnum1, fnum2)
	 D0	            D1     D0

	 float SPMul(float fnum1, float fnum2);

@{b}   FUNCTION@{ub}
	 Accepts two floating point numbers and returns the arithmetic
	 multiplication of said numbers.

@{b}   INPUTS@{ub}
	 fnum1 	 - floating point number
	 fnum2 	 - floating point number

@{b}   RESULT@{ub}
	 fnum3 	 - floating point number

@{b}   BUGS@{ub}
	 None

@{b}   SEE ALSO@{ub}

@EndNode

@Node "SPNeg()" "mathffp.library/SPNeg"

@{b}   NAME@{ub}
	 SPNeg -- Negate the supplied floating point number.

@{b}   SYNOPSIS@{ub}
 	 fnum2 = SPNeg(fnum1)
  	 D0	            D0

	 float SPNeg(float fnum1);

@{b}   FUNCTION@{ub}
	 Accepts a floating point number and returns the value
	 of said number after having been subtracted from 0.0.

@{b}   INPUTS@{ub}
	 fnum1 	 - floating point number.

@{b}   RESULT@{ub}
	 fnum2 	 - floating point negation of fnum1.

@{b}   BUGS@{ub}
	 None

@{b}   SEE ALSO@{ub}

@EndNode

@Node "SPSub()" "mathffp.library/SPSub"

@{b}   NAME@{ub}
	 SPSub -- Subtract two floating point numbers.

@{b}   SYNOPSIS@{ub}
	 fnum3 = SPSub(fnum1, fnum2)
	 D0	            D1     D0

	 float SPSub(float fnum1, float fnum2);

@{b}   FUNCTION@{ub}
	 Accepts two floating point numbers and subtracts
	 the first argument from the second.

@{b}   INPUTS@{ub}
	 fnum1 	 - floating point number.
	 fnum2 	 - floating point number.

@{b}   RESULT@{ub}
	 fnum3 	 - floating point number.

@{b}   BUGS@{ub}
	 Former attempts to document this function did not
	 make clear which argument is subtracted from which.

	 Note that the order of subtraction is identical to
	 the order of subtraction of IEEE math if looked at
	 the register allocation. but the *inverse* of the
	 IEEE model if looked at the position of the function
	 arguments, i.e. IEEE math subtracts the second argument
	 from the first.

@{b}   SEE ALSO@{ub}

@EndNode

@Node "SPTst()" "mathffp.library/SPTst"

@{b}   NAME@{ub}
	 SPTst - Compares a float against zero (0.0).

@{b}   SYNOPSIS@{ub}
	 result = SPTst(fnum)
	   D0         D1

	 int SPTst(float fnum);

@{b}   FUNCTION@{ub}
	 Accepts a floating point number and returns the condition
	 codes set to indicate the result of a comparison against
	 the value of zero (0.0).  Additionally, the integer functional
	 result is returned.

@{b}   INPUTS@{ub}
	 fnum 	 - floating point number.

@{b}   RESULT@{ub}
	 Condition codes set to reflect the following branches:

		EQ - fnum =  0.0
		NE - fnum != 0.0
		PL - fnum >= 0.0
		MI - fnum <  0.0

	 Integer functional result as:

		+1 => fnum > 0.0
		-1 => fnum < 0.0
		 0 => fnum = 0.0

@{b}   BUGS@{ub}
	 None.

@{b}   SEE ALSO@{ub}

@EndNode

