TABLE OF CONTENTS

mathieeesingbas.library/--Background--
mathieeesingbas.library/IEEESPAbs
mathieeesingbas.library/IEEESPAdd
mathieeesingbas.library/IEEESPCeil
mathieeesingbas.library/IEEESPCmp
mathieeesingbas.library/IEEESPDiv
mathieeesingbas.library/IEEESPFix
mathieeesingbas.library/IEEESPFloor
mathieeesingbas.library/IEEESPFlt
mathieeesingbas.library/IEEESPMul
mathieeesingbas.library/IEEESPNeg
mathieeesingbas.library/IEEESPSub
mathieeesingbas.library/IEEESPTst
mathieeesingbas.library/--Background--	mathieeesingbas.library/--Background--

   PURPOSE

	The mathieeesingbas.library provides basic arithmetic functions for
	handling double precision IEEE numbers. If a FPU is found present in
	the system, this library uses the FPU for calculations. Otherwise,
	the CPU will provide a suitable emulation.

	The 68040 and 68060 built-in FPUs do not provide all instructions
	that the 68881/882 FPUs implement, and hence some of their 
	instructions have to be emulated in software. This works either
	by the FPU specific trap vectors that have been installed by the
	68040 or 68060.library on boot-up, or - if available - by the
	fpsp.resource which is optionally linked into the system by the 
	680?0 libraries.

	The advantage of the resource solution is that it does not require
	the overhead caused by the exception processing.
	All this - complete CPU usage, FPU usage plus optional fpsp.resource
	support - is completely transparent to the user of this library.

	As of V45 of this library, the mathieee.resources are no longer 
	supported. It was felt that this solution was never very popular,
	neither very fast compared to a coprocessor interface, and highly 
	obsolete.


   CAVEATS

	The library base of the mathieeesingbas.library MUST NOT be shared
	among tasks. The reason for this restriction is that the library
	open vector requires to initialize the FPU properly for the caller's
	task context.
	Hence, you may not open this library in one task, pass the library
	base over and use it from another task as the FPU initialization
	would not be run for the second task. You must re-open the library
	again from the second task.

	This restriction has some implications in using the math IEEE
	libraries from within other libraries. The first implication is that
	opening the mathieeesingbas.library in the LibInit() function IS NOT
	ENOUGH to ensure proper operation as it will initialize the FPU in
	the context of the ramlib process loading the library, but not in
	the context of the caller. This is obviously of no use for the task 
	that wants to use IEEE math.
	
	Instead, it is recommended to (re-)open the mathieeesingbas.library
	once for each LibOpen() within your library, and to close it once
	for each LibClose() call. 

	As a special rule that is hereby documented, the result code of
	subsequent OpenLibrary() calls once the library is open will be 
	either NULL on error, or the same library base you received by the
	initial OpenLibrary(), i.e. in LibInit().
	
	Even though this releases you from the obligation to keep a private
	copy of the math library base once for each LibOpen(), it does not
	release you from re-opening the library again for each caller.
	It is enough to check wether the library opened successfully, and to
	throw the library base away afterwards, though. It will not deliver
	task-dependent library bases if it opens successfully.

	The second implication is that the same, or more restrictions apply
	to your library then as well, and, in fact, to its full tree of
	callers. Its library base may not be shared among tasks and must be
	re-openend for each potential caller. 

	Note that you should document these requirements!

	The reason is again that the mathieee FPU init code must be run for
	each task that wants to use your, and hence this math library.
	Whether you deliver a per-task allocated library base, or one and
	the same library base is, of course, up to you.

	To overcome this limitation, your library might want to launch a
	side task that runs all the mathematical computations such that 
	all callers of your library never enter a single function of the
	IEEE libs. Then, of course, the IEEE libs should not be opened
	in LibInit() or LibOpen(), but in the startup code of the side task,
	and should be closed by its shutdown code.


	Since the FPU initialization performed by the library depends on
	the selected precision, i.e. IEEE double vs. IEEE single precision,
	the third implication is that you must not mix the double and single
	precision math libraries within the same task. Either, you decide for
	double precision and stay with it, or you decide for single precision
	once and for all. You may not perform some calculations in double,
	and others in single precision as both kinds of libraries require the
	same hardware - namely the FPU - but with different settings.

	This goes of course, too, to the full caller tree of a library that
	runs IEEE functions in the context of its callers.



	Not following these rules may cause slightly wrong results in the
	sense that they might not be rounded properly to the selected
	precision. It may also cause other strange and wonderful side effects
	that are not mentioned here, and will make the library unreliable
	from a numerical point of view.



   BUGS
	The ROM resident mathieeesingbas.library is not necessarely
	initialized correctly such that it might not be able to use the FPU
	of a 68040 or 68060 even though a FPU is present. This bug is
	fixed by either the 68040 or 68060.libraries, or by SetPatch.
mathieeesingbas.library/IEEESPAbs           mathieeesingbas.library/IEEESPAbs

   NAME
	IEEESPAbs -- compute absolute value of IEEE single precision argument

   SYNOPSIS
	  x   = IEEESPAbs(  y  );
	 d0		    d0

	float	x,y;

   FUNCTION
	Take the absolute value of argument y and return it to caller.

   INPUTS
	y -- IEEE single precision floating point value

   RESULT
	x -- IEEE single precision floating point value

   BUGS

   SEE ALSO
mathieeesingbas.library/IEEESPAdd           mathieeesingbas.library/IEEESPAdd

   NAME
	IEEESPAdd -- add one single precision IEEE number to another

   SYNOPSIS
	  x   = IEEESPAdd(  y  ,  z  );
	 d0		   d0     d1

	float	x,y,z;

   FUNCTION
	Compute x = y + z in IEEE single precision.

   INPUTS
	y -- IEEE single precision floating point value
	z -- IEEE single precision floating point value

   RESULT
	x -- IEEE single precision floating point value

   BUGS

   SEE ALSO
	IEEESPSub()
mathieeesingbas.library/IEEESPCeil         mathieeesingbas.library/IEEESPCeil

   NAME
	IEEESPCeil -- compute Ceil function of IEEE single precision number

   SYNOPSIS
	  x   = IEEESPCeil(  y  );
	 d0		     d0

	float	x,y;

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

   INPUTS
	y -- IEEE single precision floating point value

   RESULT
	x -- IEEE single precision floating point value

   BUGS

   SEE ALSO
	IEEESPFloor()
mathieeesingbas.library/IEEESPCmp           mathieeesingbas.library/IEEESPCmp

   NAME
	IEEESPCmp -- compare two single precision floating point numbers

   SYNOPSIS
	  c   = IEEESPCmp(  y  ,  z  );
	  d0		    d0   d1

	float	y,z;
	long	c;

   FUNCTION
	Compare y with z. Set the condition codes for less, greater, or
	equal. Set return value c to -1 if y<z, or +1 if y>z, or 0 if
	y == z.

   INPUTS
	y -- IEEE single precision floating point value
	z -- IEEE single precision floating point value

   RESULT
       c = 1   cc = gt         for (y > z)
       c = 0   cc = eq         for (y == z)
       c = -1  cc = lt         for (y < z)

   BUGS

   SEE ALSO
mathieeesingbas.library/IEEESPDiv           mathieeesingbas.library/IEEESPDiv

   NAME
	IEEESPDiv -- divide one single precision IEEE by another

   SYNOPSIS
	  x   = IEEESPDiv(  y  ,  z  );
	 d0		   d0    d1

	float	x,y,z;

   FUNCTION
	Compute x = y / z in IEEE single precision.
	Note that the Motorola fast floating point Div routine reverses
	the order of the arguments for the C interface, although the
	dividend is still in d0 and the divisor is in d1.

   INPUTS
	y -- IEEE single precision floating point value
	z -- IEEE single precision floating point value

   RESULT
	x -- IEEE single precision floating point value

   BUGS
	Due to a bug in the ROM of some Amiga models, this function should
	not be called prior running SetPatch.

   SEE ALSO
	IEEESPMul()
mathieeesingbas.library/IEEESPFix           mathieeesingbas.library/IEEESPFix

   NAME
	IEEESPFix -- convert IEEE single float to integer

   SYNOPSIS
	x   = IEEESPFix(  y  );
	d0		 d0

	long	x;
	float	y;

   FUNCTION
	Convert IEEE single precision argument to a 32 bit signed integer
	and return result.

   INPUTS
	y -- IEEE single precision floating point value

   RESULT
	if no overflow occured then return
		x -- 32 bit signed integer
	if overflow return largest +- integer
		For round to zero

   BUGS

   SEE ALSO
	IEEESPFlt()
mathieeesingbas.library/IEEESPFloor       mathieeesingbas.library/IEEESPFloor

   NAME
	IEEESPFloor -- compute Floor function of IEEE single precision number

   SYNOPSIS
	  x   = IEEESPFloor(  y  );
	  d0		      d0

	float	x,y;

   FUNCTION
	Calculate the largest integer less than or equal to x and return it.

   INPUTS
	y -- IEEE single precision floating point value

   RESULT
	x -- IEEE single precision floating point value

   BUGS

   SEE ALSO
	IEEESPCeil()
mathieeesingbas.library/IEEESPFlt           mathieeesingbas.library/IEEESPFlt

   NAME
	IEEESPFlt -- convert integer to IEEE single precision number

   SYNOPSIS
	  x   = IEEESPFlt(  y  );
	 d0		   d0

	float	x;
	long	y;

   FUNCTION
	Convert a signed 32 bit value to a single precision IEEE value
	and return it in d0. No exceptions can occur with this
	function.

   INPUTS
	y -- 32 bit integer in d0

   RESULT
	x is a 32 bit single precision IEEE value

   BUGS

   SEE ALSO
	IEEESPFix()
mathieeesingbas.library/IEEESPMul           mathieeesingbas.library/IEEESPMul

   NAME
	IEEESPMul -- multiply one double precision IEEE number by another

   SYNOPSIS
	  x   = IEEESPMul(  y  ,  z  );
	 d0		   d0    d1

	float	x,y,z;

   FUNCTION
	Compute x = y * z in IEEE single precision.

   INPUTS
	y -- IEEE single precision floating point value
	z -- IEEE single precision floating point value

   RESULT
	x -- IEEE single precision floating point value

   BUGS
	Due to a bug in the ROM of some Amiga models, this function should
	not be called prior running SetPatch.

   SEE ALSO
	IEEESPDiv()
mathieeesingbas.library/IEEESPNeg           mathieeesingbas.library/IEEESPNeg

   NAME
	IEEESPNeg -- compute negative value of IEEE single precision number

   SYNOPSIS
	  x   = IEEESPNeg(  y  );
	  d0		   d0

	float	x,y;

   FUNCTION
	Invert the sign of argument y and return it to caller.

   INPUTS
	y - IEEE single precision floating point value

   RESULT
	x - IEEE single precision floating point value

   BUGS

   SEE ALSO
mathieeesingbas.library/IEEESPSub           mathieeesingbas.library/IEEESPSub

   NAME
	IEEESPSub -- subtract one single precision IEEE number from another

   SYNOPSIS
	  x   = IEEESPSub(  y  ,  z  );
	 d0		   d0     d1

	float	x,y,z;

   FUNCTION
	Compute x = y - z in IEEE single precision.

   INPUTS
	y -- IEEE single precision floating point value
	z -- IEEE single precision floating point value

   RESULT
	x -- IEEE single precision floating point value

   BUGS

   SEE ALSO
	IEEESPAdd()
mathieeesingbas.library/IEEESPTst           mathieeesingbas.library/IEEESPTst

   NAME
	IEEESPTst -- compare IEEE single precision value to 0.0

   SYNOPSIS
	  c   = IEEESPTst(  y  );
	  d0		    d0

	float	y;
	long	c;

   FUNCTION
	Compare y to 0.0, set the condition codes for less than, greater
	than, or equal to 0.0.  Set the return value c to -1 if less than,
	to +1 if greater than, or 0 if equal to 0.0.

   INPUTS
	y -- IEEE single precision floating point value

   RESULT
	c = 1	cc = gt		for (y > 0.0)
	c = 0	cc = eq		for (y == 0.0)
	c = -1  cc = lt		for (y < 0.0)

   BUGS

   SEE ALSO
