Arithmetic Functions
 
 
 

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

Arithmetic functions

Function

Description

(+ (add) [ number number] ...)

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)

(abs number)

Returns the absolute value of the argument

(atan num1 [num2])

Returns the arctangent of a number in radians

(cos ang)

Returns the cosine of an angle expressed in radians

(exp number)

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

(expt base power)

Returns a number raised to a specified power

(fix number)

Returns the conversion of a real into the nearest smaller integer

(float number)

Returns the conversion of a number into a real

(gcd int1 int2)

Returns the greatest common denominator of two integers

(log number)

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 [ int int ...])

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

(lsh [ int numbits])

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

(minusp number)

Verifies that a number is negative

(rem [ num1 num2 ...])

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

(sin ang)

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

(sqrt number)

Returns the square root of a number as a real

(zerop number)

Verifies that a number evaluates to zero