							07-Mar-93

To all Pro-MC users:

There is a flaw in Pro-MC's dfix() function.  Since the dint(), floor() and
ceil() functions invoke dfix(), the flaw extends to those functions also.

The problem lies in its methodology, namely that it performs truncation by
converting the float to a long int and then back to a float again.  This method
fails when the value of the double is larger than the maximum value which can
be held in a long int, in which case no truncation is performed.

The accompanying file, FDFIX/REL, solves this problem.  The method used is to
determine how many bits are to the "right" of the implied decimal point, and
then reset them.  This method is both fast and accurate.  The source code for
FDFIX/REL can be found as FDFIX/ASM in this archive.

Ideally, FDFIX/REL should be used to replace the existing FDFIX module in LIBA.
Unfortunately, LIBA cannot be loaded into the MLIB buffer area; so it must
first be split into smaller pieces using SLIB.  Therefore, if you have both
these programs (MLIB and SLIB), proceed as follows:

SLIB LIBA 9100 :d
MLIB
L<oad> LIBA/R01
R<eplace> FDFIX
[the filename, of course, is FDFIX]
S<ave> LIBA/R01
<e>X<it>
from LS-DOS Ready:
APPEND LIBA/R02 LIBA/R01 (STRIP)
COPY [or BACKUP] LIBA/R01 LIBA/REL
REMOVE LIBA/R01 LIBA/R02

If you do not have BOTH the programs MLIB and SLIB, then you have no choice but
to add FDFIX to your USERLIB, via:

	APPEND FDFIX/REL USERLIB/REL (STRIP).

NOTE:	If you have MLIB but don't have SLIB, I suggest you order it from
	Misosys, Inc., NOW.  It's cheap as dirt, and will soon be discontinued!
	While you're at it, another *very* useful utility for library manage-
	ment (UNREL) is also on closeout.  I suggest you get this one, too,
	before it's too late.

				    --------

The other file in this archive, ROUND/REL, adds a useful new function -- one
which is commonly found in other implementations of the language, as follows:

     double round( arg )
     double arg;

     This function returns the rounded value of "arg."  "Arg" is rounded
     down if the fractional portion is < 0.5.  Otherwise, it is rounded up.
     The function implements the following code:

     #option MATHLIB
     double round( arg )
     double arg;
     {   if ( fabs( arg - floor( arg ) ) < 0.5 )
	     return floor( arg );
	 else
	     return ceil( arg );
     }

If you want to add this new round() function, proceed as follows:

If you have MLIB, load the math library (MATH/REL).  Then select the "<I>nsert
before" menu option, and specify CEIL.  When asked for the file name, it is, of
course, ROUND.  Then save MATH/REL.

If you do not have MLIB, you have no choice but to add ROUND to your USERLIB,
via:

	APPEND ROUND/REL USERLIB/REL (STRIP).

If you decide to add round() to your math or user library, I suggest you edit
MATH.H to include round() in the list of declared external doubles so you won't
have to remember to do this in each program.

And, while you're doing that, you might as well edit STDIO.H by adding labs()
to ftell() in the extern off_t list, or add a new line: "extern long labs();".

- J.F.R. "Frank" Slinkman, 72411,650
