PDA

View Full Version : Round up to the nearest even number



ReachAndre
2007-04-13, 05:51 PM
Hello all, I am trying to creaet a lisp with an even number as an output. How would I round up to the nearest EVEN number? (always round up)
Here is my code so far


(defun c:cool (/ inputval)
(setq inputval (getreal "input value: "))
(setq output (* inputval 0.32))
(Somehow make even whole number)
(alert (strcat (rtos evened 2 0) " of input"))
(princ)
)Thank you all in advance,
Andre

[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]

.T.
2007-04-13, 06:25 PM
Hello all, I am trying to creaet a lisp with an even number as an output. How would I round up to the nearest EVEN number? (always round up)
Here is my code so far

(defun c:cool (/ inputval)
(setq inputval (getreal "input value: "))
(setq output (* inputval 0.32))
(Somehow make even whole number)
(alert (strcat (rtos evened 2 0) " of input"))
(princ))

Thank you all in advance,
Andre
The one provided for you HERE (http://forums.augi.com/showthread.php?t=54317) doesn't work?


(roundup 12.3 2)
14

ReachAndre
2007-04-16, 02:22 PM
That did work,
I was thinking to do it a different way so it never crossed my mind to mess with that one again.
Thanks