The AutoCADET's Guide to Visual LISP: Optimize and Customize Your AutoCAD Design Environment

Chapter 5: Working with Numbers

Engineering and architectural applications typically involve computations on a grand scale, and the programmer must understand the nature of the numbers used. For this reason, this chapter explores the basic numeric types in Visual LISP and introduces the subrs provided for working with numbers.

Because of the environment in which Visual LISP is typically used, it provides many tools for manipulating numeric data. For more detailed information as well as additional examples involving numeric data types, consult the Visual LISP online help file system.

Integers

The most basic type of number in the computer is the integer. Integers are whole numbers; they have no decimal point and no fractional component. Many computer languages support a variety of integer types, with each a different size (often counted in terms of bytes of memory). Visual LISP, however, provides only one type: a 4-byte (32-bit) integer. This type can hold integers ranging from 2,147,483,647 to -2,147,483,648, which is sufficient for most applications.

Note that the GETINT function, which is used for integer input from the operator, accepts only 16-bit integers. This is an artifact from an older version of AutoLISP.

Integers are commonly used for counting and specifying the byte position in a file. The primary advantage of using integers is that they can be manipulated faster than real numbers.

The primary disadvantage of using integers is that they cannot represent fractions or numbers containing digits to the right of the decimal point. For example, if you divide the integer 1 by...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Radiometers
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.