|Page (1) of 2 - 12/26/01||email article||print page|
AutoLISP tip - Integer and real numbers
AutoLISP works with 32 bits values. So the value could be between +2,147,483,648 and -2,147,483,647. But the transfer to AutoCAD is restricted to 16 bits.
Reals contain a decimal point. A precision of 14 digits is used for reals. Although 14 digits are not always shown. Only six digits are shown.
Watch out now. Watch out when programming in AutoLISP. Suppose you're using a real number and not an integer. Then specify a real number.
Maybe you've got a line like this in your program:
(setq nr 10)
You want to number 10 to be a real. Than change that line. Change it to:
(setq nr 10.0)
Here's a simple program that shows where it can go wrong:
(defun dgtrd (an)
(* (/ an 180) pi)
(defun c:count ()
(setq a1 0)
(setq a2 (dgtrd a1))
(princ " Degrees: ")
(princ " Radians: ")
(setq a1 (- a1 10))
Related Keywords:CAD, AutoLISP
Source:Digital Media Online. All Rights Reserved