FPLIB implements the set of routines described in K&R, Second Edition,
pp 250-251. In the following descriptions, x and y are of type float,
and n is of type int. All functions (including ceil and floor) return
a value of type float.
Remember to declare any routine you use, either explicitly or by
including MATH.H. If you don't, the compiler will assume the function
returns a value of type int, and will perform an unwanted conversion.
A domain error occurs if an argument is outside the range for which
the function is defined (e.g. sqrt(-1.0)). In this case, errno is
set to EDOM and the result is usually 0.0. A range error occurs if
the result cannot be represented as a float (e.g. exp(100.0)). In
this case, errno is set to ERANGE and the result is HUGE_VAL. If the
function succeeds, errno is not zeroed.
In all trigonometric functions, angles are expressed in radians. Pi
radians equal 180 degrees.
All routines work in all three resolutions :-)
sin(x) sine of x.
cos(x) cosine of x.
tan(x) tangent of x.
asin(x) inverse sine of x in the range -pi/2 to pi/2.
acos(x) inverse cosine of x in the range 0 to pi.
atan(x) inverse tangent of x in the range -pi/2 to pi/2.
atan2(x,y) inverse tangent of x/y in the range -pi to pi. The
angle is chosen so that x has the sign of the sine and
y has the sign of the cosine.
sinh(x) hyperbolic sine of x.
cosh(x) hyperbolic cosine of x.
tanh(x) hyperbolic tangent of x.
exp(x) e to the power of x.
log(x) logarithm, base e, of x: x > 0.
log10(x) logarithm, base 10, of x: x > 0.
pow(x,y) x to the yth power. A domain error occurs if x=0 and
y<=0, or if x<0 and y is not an integer.
sqrt(x) square root of x: x>=0.
ceil(x) smallest whole number not less than x.
floor(x) largest whole number not greater than x.
fabs(x) absolute value of x.
ldexp(x,n) x, times 2 to the nth power.
frexp(x,pn) splits x into a fraction between 0.5 and 0.999..., which
is the returned value, and a power of 2, which is stored
in the int pointed to by pn. If x is 0, both parts of
the result are 0.
modf(x,py) splits x into integral and fractional parts, both with
the same sign as x. The fraction is returned and the
integral part is stored in the float pointed to by py.
fmod(x,y) remainder of x/y, with the same sign as y.
atof(ps) converts the string ps into a float.
The file MATH.H also defines several mathematical constants.