XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

23  Arithmetic Functions


  1. truncate - truncates a floating point number to an integer
  2. float - converts an integer to a floating point number
  3.  +  - add a list of numbers
  4.  -  - subtract a list of numbers or negate a single number
  5.  *  - multiply a list of numbers
  6.  /  - divide a list of numbers
  7. 1+ - add one to a number
  8. 1- - subtract one from a number
  9. rem - remainder of a list of numbers
  10. min - the smallest of a list of numbers
  11. max - the largest of a list of numbers
  12. abs - the absolute value of a number
  13. gcd - compute the greatest common divisor
  14. random - compute a random number between 0 and n-1 inclusive
  15. sin - compute the sine of a number
  16. cos - compute the cosine of a number
  17. tan - compute the tangent of a number
  18. asin - compute the arcsine of a number
  19. acos - compute the arccosine of a number
  20. atan - compute the arctangent of a number
  21. expt - compute x to the y power
  22. exp - compute e to the x power
  23. sqrt - compute the square root of a number
  24.  <  - test for less than
  25.  <=  - test for less than or equal to
  26.  =  - test for equal to
  27.  /=  - test for not equal to
  28.  >=  - test for greater than or equal to
  29.  >  - test for greater than

(truncate expr) - truncates a floating point number to an integer
expr - the number
returns - the result of truncating the number

(float expr) - converts an integer to a floating point number
expr - the number
returns - the result of floating the integer

( +  expr...) - add a list of numbers
expr - the numbers
returns - the result of the addition

( -  expr...) - subtract a list of numbers or negate a single number
expr - the numbers
returns - the result of the subtraction

( *  expr...) - multiply a list of numbers
expr - the numbers
returns - the result of the multiplication

( /  expr...) - divide a list of numbers
expr - the numbers
returns - the result of the division

(1+ expr) - add one to a number
expr - the number
returns - the number plus one

(1- expr) - subtract one from a number
expr - the number
returns - the number minus one

(rem expr...) - remainder of a list of numbers
expr - the numbers
returns - the result of the remainder operation

(min expr...) - the smallest of a list of numbers
expr - the expressions to be checked
returns - the smallest number in the list

(max expr...) - the largest of a list of numbers
expr - the expressions to be checked
returns - the largest number in the list

(abs expr) - the absolute value of a number
expr - the number
returns - the absolute value of the number

(gcd n1 n2...) - compute the greatest common divisor
n1 - the first number [integer]
n2 - the second number[s] [integer]
returns - the greatest common divisor

(random n) - compute a random number between 0 and n-1 inclusive
n - the upper bound [integer]
returns - a random number

(sin expr) - compute the sine of a number
expr - the floating point number
returns - the sine of the number

(cos expr) - compute the cosine of a number
expr - the floating point number
returns - the cosine of the number

(tan expr) - compute the tangent of a number
expr - the floating point number
returns - the tangent of the number

(asin expr) - compute the arcsine
expr - the floating point number
returns - the arcsine of the number
Note: not implemented in Nyquist.

(acos expr) - compute the arccosine
expr - the floating point number
returns - the arccosine of the number
Note: not implemented in Nyquist.

(atan expr [expr2]) - compute the arctangent
expr - the value of x
expr2 - the value of y [default value is 1.0]
returns - the arctangent of x/y

(expt x-expr y-expr) - compute x to the y power
x-expr - the floating point number
y-expr - the floating point exponent
returns - x to the y power

(exp x-expr) - compute e to the x power
x-expr - the floating point number
returns - e to the x power

(sqrt expr) - compute the square root of a number
expr - the floating point number
returns - the square root of the number

( <  n1 n2...) - test for less than
( <=  n1 n2...) - test for less than or equal to
( =  n1 n2...) - test for equal to
( /=  n1 n2...) - test for not equal to
( >=  n1 n2...) - test for greater than or equal to
( >  n1 n2...) - test for greater than
n1 - the first number to compare
n2 - the second number to compare
returns - T if the results of comparing n1 with n2, n2 with n3, etc., are all true.

XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next