Arithmetic Functions

AutoCAD AutoLISP & Visual LISP

 
Arithmetic Functions
 
 
 

The following table provides summary descriptions of the AutoLISP arithmetic functions.

Arithmetic functions

Function

Description

(+ (add) [numbernumber] ...)

Returns the sum of all numbers

(- (subtract) [number number] ...)

Subtracts the second and following numbers from the first and returns the difference

(* (multiply)[number number] ...)

Returns the product of all numbers

(/ (divide)[number number] ...)

Divides the first number by the product of the remaining numbers and returns the quotient

(~ (bitwise NOT)int)

Returns the bitwise NOT (1's complement) of the argument

(1+ (increment)number)

Returns the argument increased by 1 (incremented)

(1- (decrement)number)

Returns the argument reduced by 1 (decremented)

(absnumber)

Returns the absolute value of the argument

(atannum1 [num2])

Returns the arctangent of a number in radians

(cosang)

Returns the cosine of an angle expressed in radians

(expnumber)

Returns the constant e (a real) raised to a specified power (the natural antilog)

(exptbase power)

Returns a number raised to a specified power

(fixnumber)

Returns the conversion of a real into the nearest smaller integer

(floatnumber)

Returns the conversion of a number into a real

(gcdint1 int2)

Returns the greatest common denominator of two integers

(lognumber)

Returns the natural log of a number as a real

(logand [int int ...])

Returns the result of the logical bitwise AND of a list of integers

(logior [intint ...])

Returns the result of the logical bitwise inclusive OR of a list of integers

(lsh [intnumbits])

Returns the logical bitwise shift of an integer by a specified number of bits

(max [number number ...])

Returns the largest of the numbers given

(min [number number ...])

Returns the smallest of the numbers given

(minuspnumber)

Verifies that a number is negative

(rem [num1 num2 ...])

Divides the first number by the second, and returns the remainder

(sinang)

Returns the sine of an angle as a real expressed in radians

(sqrtnumber)

Returns the square root of a number as a real

(zeropnumber)

Verifies that a number evaluates to zero