4 AutoLisp Programming : Arithmetic Functions


=============================================

1 AutoLisp Programming : Introduction

2 AutoLisp Programming : Basic Knowledge Essentials

3 AutoLisp Programming : DataTypes

4 AutoLisp Programming : Arithmetic Functions

5 AutoLisp Programming : Trignometric Functions

6 AutoLisp Programming : Mathematical Functions

7 AutoLisp Programming : Exercise 01

8 AutoLisp Programming : Structure Functions

9 AutoLisp Programming : All Commands

=============================================

 

Arithmetic function in AutoLISP

 

Arithmetic functions:

There are four functions in Arithmetic function for AutoLISP. The arguments for these functions can be numbers, symbols and constants.

Important Note: If any one of the agruments is a real value the result produced by the function will be a real value. If all the arguments are integer then the result will be an integer.


Function : “+” (Addition)
Description: This function return the sum of all the arguments which are of datatype real or integer value.
Syntax: (+ <number1> <number2> …)
Example 1: (+ 5 3) result will be 8
Example 2: (+ 11.23 5) result will be 16.23


Function : “-” (Subtract)
Description: This function subtracts the second number from the first number.
Syntax: (- <number1> <number2> …)
Example1: (- 7.5 2) result will be 5.5
Example2: (- 2) result will be -2


Function : “*” (Multiplication or Product)
Description: This function returns the product of all arguments passed.
Syntax: (* <number1> <number2> …)
Example1: (* 5 4 2) result will be 40
Example2: (* 5.5 2) result will be 11.0


Function : “/” (Divide)
Description: This function returns the quotient by dividing the first number by the product of the remaining numbers.
Syntax: (/ <number1> <number2> …)
Example1: (/ 5 4) result will be 1
Example2: (/ 5 4.0) result will be 1.25

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s