Dec 282017
Math functions to accompany xlisp.
File XMATH.ZIP from The Programmer’s Corner in
Category Miscellaneous Language Source Code
Math functions to accompany xlisp.
File Name File Size Zip Size Zip Type
XMATH.DOC 4146 1157 deflated
XMATH.LSP 5466 1705 deflated

Download File XMATH.ZIP Here

Contents of the XMATH.DOC file

XLISP Math Library
George V. Wilson

This library provides some Common LISP math support for XLISP. It was
written and tested using XLISP ver. 1.6. To load the library from XLISP,
type (load 'math) .

Loading the library will have the following effects.

1. pi will be a global variable with value 3.1415926536

2. A number of XLISP math functions work only for floating point
arguements. The library redefines these to work for with
integer arguements as well (by floating the arguements).
The functions redefined for this reason are:
sqrt square root
sin sine
cos cosine
tan tangent
exp e to the x
expt x to the y

3. A number of Common LISP math functions are missing from XLISP.
The library adds the following functions:
signum x (number) 1 if x>0
-1 if x<0
0 if x=0

round x (number) x rounded to
an integer

atan x (number) arctan(x)

asin x (number) arcsin(x)

acos x (number) arccos(x)

log x (number)
y (number)(optional) if y is supplied
return is log
base y of x. If
y is not supplied,
return is ln(x)

integerp x (any object) returns T if x is
an integer, NIL

gcd any number of returns the greatest
integer arguements common divisor of
the arguements.

lcm any number of returns the least
integer arguements common multiple
of the arguements.

incf x (number) returns x+y and has
y (number)(optional) also binds x to x+y

4. A non-Common LISP function euclid_gcd is created which was used
in writing gcd. This function finds the gcd of two positive

5. A global variable named *math_lib_loaded* is created and set to T.
The math library will load only if this variable is unbound. This
prevents loading the library twice, which would destroy the
functions described in 2. above. If the library could be loaded
twice, calling these functions would produce infinite loops.

The new floating point functions should produce full single precision
accuracy. The functions have been carefully tested, but oversights are
always possible. If you have trouble with one of the functions, please
give me a full description of the circumstances at:

George V. Wilson
3932 Lincolnshire St.
Annandale, VA 22003

 December 28, 2017  Add comments

Leave a Reply