.ps 55,65
.title CP/M-68K C Floating Point Routines
.subtitle ATOF
.page
.hl 1;ATOF Routine
Synopsis:
.bl 1
.nofill
	FLOAT	 atof();
	FLOAT	 rval;
	BYTE	*string;
		.
		.
		.
	rval = atof(string);
.bl 1
.fill
^&atof\& converts a floating point number from ASCII string format to a
^&float\& data type.  The input string takes the form:
.bl 1
[-]ddddd.ddd[e[-]dd]
.bl 1
where the leading sign and exponent fields are optional.  Each "d" is a decimal
digit.  The string may contain leading blanks but may not contain embedded
blanks.   Conversion stops at the first character which does not correspond
to the format described above.
.bl 1
Notes:
.bl 1
There is no overflow detection, nor is there any way to determine how many 
digits were processed.
.subtitle ceil
.page
.hl 1;ceil Routine
Synopsis:
.bl 1
.nofill
	DOUBLE	ceil();
	DOUBLE	arg;
	DOUBLE	retval;
		.
		.
		.
	retval = ceil(arg);
.bl 1
.fill
The ^&ceil\& function returns the smallest integer (as a double precision
floating point number) which is not smaller than the argument.  For example,
^&ceil(1.5)\& returns 2.0.
.bl 1
Notes:
.bl 1
.subtitle etoa
.page
.hl 1;etoa Routine
Synopsis:
.bl 1
.nofill
	FLOAT	fval;
	BYTE	*etoa();
	BYTE	*buf;
	WORD	prec;
	BYTE 	*retval;
		.
		.
		.

	retval = etoa(fval,buf,prec);
.bl 1
.fill
The ^&etoa\& routine converts a floating point number to an ASCII string.
The output string has the format:
.bl 1
[-]d.ddddde[-]dd
.bl 1
Where each "d" is a decimal digit.  The string is terminated by a null (zero)
byte.
.bl 1
^&etoa\& returns the address of the converted buffer, "buf".  The "fval"
argument is the floating point value to be converted.  "prec" is the number
of digits to appear to the right of the decimal point.
.bl 1
Notes:
.bl 1
.subtitle fabs
.page
.hl 1;fabs Routine
Synopsis:
.bl 1
.nofill
	FLOAT	fabs();
	FLOAT	fval;
	FLOAT	retval;
		.
		.
		.
	retval = fabs(fval);	
.bl 1
.fill
The ^&fabs\& routine returns the absolute value of a floating point number.
.bl 1
Notes:
.bl 1
.subtitle floor
.page
.hl 1;floor Routine
Synopsis:
.bl 1
.nofill
	DOUBLE	floor();
	DOUBLE	fval;
	DOUBLE	rval;
		.
		.
		.
	rval = floor(fval);
.bl 1
.fill
The ^&floor\& routine returns the largest integer (as a double precision
floating point number) which is not greater than the argument to ^&floor\&.
For example, ^&floor(1.5)\& returns 1.0.
.bl 1
Notes:
.bl 1
.subtitle fmod
.page
.hl 1;fmod Routine
Synopsis:
.bl 1
.nofill
	DOUBLE	fmod();
	DOUBLE	x;
	DOUBLE	y;
	DOUBLE	rval;
		.
		.
		.
	rval = fmod(x,y);
.bl 1
.fill
The ^&fmod\& routine returns the floating point modulus of its two arguments.
The modulus "rval" of the two numbers "x" and "y" is a number such that:
.bl 1
.nofill
	x = iy + rval
	     -and-
	0 <= rval <= y.
.bl 1
.fill
"i" in this case is an integer value obtained by dividing y by x.
.bl 1
Notes:
.bl 1
.subtitle cos
.page
.hl 1;cos Routine
Synopsis:
.bl 1
.nofill
	DOUBLE	cos();
	DOUBLE	fval;
	DOUBLE	rval;
		.
		.
		.
	rval = cos(fval);
.bl 1
.fill
The ^&cos\& routine returns the cosine of the supplied argument, which must
be expressed in radians.
.bl 1
Notes:
.bl 1
The best precision is obtained with numbers which are less than two pi.
.subtitle exp
.page
.hl 1;exp Routine
Synopsis:
.bl 1
.nofill
	DOUBLE	exp();
	DOUBLE	fval;
	DOUBLE	rval;
		.
		.
		.
	rval = exp(fval);
.bl 1
.fill
The ^&exp\& routine returns the exponential function (e**x) of the supplied
argument.
.bl 1
Notes:
.bl 1
.subtitle log
.page
.hl 1;log Routine
Synopsis:
.bl 1
.nofill
	DOUBLE	log();
	DOUBLE	fval;
	DOUBLE	rval;
		.
		.
		.
	rval = log(fval);
.bl 1
.fill
The ^&log\& routine returns the natural logarithm of the supplied argument.
(A natural logarithm is sometimes called "log base e").
.bl 1
Notes:
.bl 1
.subtitle pow
.page
.hl 1;pow Routine
Synopsis:
.bl 1
.nofill
	DOUBLE	pow();
	DOUBLE	x,y;
	DOUBLE	rval;
		.
		.
		.
	rval = pow(x,y);
.bl 1
.fill
The ^&pow\& routine returns x to the power y, sometimes written as x**y.
.bl 1
Notes:
.bl 1
.subtitle sin
.page
.hl 1;sin Routine
Synopsis:
.bl 1
.nofill
	DOUBLE	sin();
	DOUBLE	fval;
	DOUBLE	rval;	
		.
		.
		.
	rval = sin(fval);
.bl 1
.fill
The ^&sin\& routine returns the sine of the supplied argument, which must
be in units of radians.
.bl 1
Notes:
.bl 1
The best precision is obtained with arguments which are less than two pi.
.subtitle sin
.page
.hl 1;tan Routine
Synopsis:
.bl 1
.nofill
	DOUBLE	tan();
	DOUBLE	fval;
	DOUBLE	rval;	
		.
		.
		.
	rval = tan(fval);
.bl 1
.fill
The ^&tan\& routine returns the tangent of the supplied argument, which must
be in units of radians.
.bl 1
Notes:
.bl 1
The best precision is obtained with arguments which are less than two pi.
.subtitle sqrt
.page
.hl 1;sqrt Routine
Synopsis:
.bl 1
.nofill
	DOUBLE	sqrt();
	DOUBLE	fval;
	DOUBLE	rval;
		.
		.
		.
	rval = sqrt(fval);
.bl 1
.fill
The ^&sqrt\& routine returns the square root of the supplied argument.
.bl 1
Notes:
.bl 1
The absolute value of the argument is used in computing the square root. There
is no explicit error return if the argument is negative.
.subtitle ftoa
.page
.hl 1;ftoa Routine
Synopsis:
.bl 1
.nofill
	BYTE	*ftoa();
	FLOAT	fval;
	BYTE	*buf;
	WORD	prec;
	BYTE	*rval;
		.
		.
		.
	rval = ftoa(fval,buf,prec);
.bl 1
.fill
The ^&ftoa\& routine converts the floating point number "fval" to an ASCII
string starting at the address specified by "buf".  "prec" determines the
number of digits to the right of the decimal point.
^&ftoa\& returns the "buf" address.
.bl 1
Notes:
.bl 1
The prec specifier is constrained to the range 0-9.
.subtitle atan
.page
.hl 1;atan Routine
.bl 1
.nofill
Synopsis:
.bl 1
	DOUBLE	atan();
	DOUBLE	fval;
	DOUBLE	rval;
		.
		.
		.
	rval = atan(fval)
.bl 1
.fill
Routine ^&atan\& returns the arctangent of the floating point number supplied
as the "fval" argument.
.bl 1
Notes:
.bl 1
.subtitle sinh
.page
.hl 1;sinh Routine
.bl 1
.nofill
Synopsis:
.bl 1
	DOUBLE	sinh();
	DOUBLE	fval;
	DOUBLE	rval;
		.
		.
		.
	rval = sinh(fval)
.bl 1
.fill
Routine ^&sinh\& returns the hyperbolic sine of the single floating 
point argument.   
.bl 1
Notes:
.bl 1
^&sinh(x)\& is evaluated as (e**x - e**(-x))/2.
.subtitle tanh
.page
.hl 1;tanh Routine
.bl 1
.nofill
Synopsis:
.bl 1
	DOUBLE	tanh();
	DOUBLE	fval;
	DOUBLE	rval;
		.
		.
		.
	rval = tanh(fval)
.bl 1
.fill
Routine ^&tanh\& returns the hyperbolic tangent of the single floating 
point argument.   
.bl 1
Notes:
.bl 1
^&tanh(x)\& is evaluated as cosh(x) / sinh(x).

