<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: digital root? in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5670078#M140990</link>
    <description>Thank you Henrique. That was very informative.&lt;BR /&gt;&lt;BR /&gt;While test the various solutions, I failed to use the same number for all tests and so I did not even notice the error. Simply looking for a returned number other than 0.0 was a bad idea. I greatly appreciate you help.&lt;BR /&gt;&lt;BR /&gt;Thanks again.</description>
    <pubDate>Tue, 09 Jun 2015 13:37:13 GMT</pubDate>
    <dc:creator>mid-awe</dc:creator>
    <dc:date>2015-06-09T13:37:13Z</dc:date>
    <item>
      <title>digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667218#M140976</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I need help with a lisp to calculate &lt;A title="Digital Root" href="http://en.wikipedia.org/wiki/Digital_root" target="_blank"&gt;digital roots&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems like a simple thing, but I am having dificulty with the recursive addition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:droot (/ digits dr num lst)
  (setq num (getint))
  (setq digits (strlen (rtos num)))
  (while (&amp;gt;= digits 0)
    (setq *digi* (cons (substr (rtos num) digits 1) (list *digi*)))
    (setq digits (1- digits))
  )
  (setq dr (mapcar '+ (list *digi*)))
  (setq num (strcat "\n\t=&amp;gt;&amp;gt; " num " = " dr " digital root "))
)&lt;/PRE&gt;
&lt;P&gt;Anyone interested in helping solve this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance for any help and/or advice.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2015 05:43:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667218#M140976</guid>
      <dc:creator>mid-awe</dc:creator>
      <dc:date>2015-06-06T05:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667268#M140977</link>
      <description>&lt;P&gt;Hi mid-awe,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;using your code as 'base code', and &lt;SPAN class="hps"&gt;slightly modified&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:droot (/ drt num)

  (defun drt (int / lst n str)
    (setq n (strlen (setq str (itoa int))))
    (while (&amp;gt; n 0)
      (setq lst (cons (atoi (substr str n 1)) lst))
      (setq n (1- n))
    )
    (if (&amp;gt; (strlen (itoa (setq int (apply '+ lst)))) 1)
      (drt int)
      int
    )
  )

  (if (and (not (initget 4))
           (setq num (getint "\nEnter an integer to get it's digital root: "))
      )
    (princ (strcat "\n\t=&amp;gt;&amp;gt; " (itoa num) " = " (itoa (drt num)) " digital root "))
  )
  (princ)
)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2015 09:11:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667268#M140977</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-06-06T09:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667279#M140978</link>
      <description>&lt;P&gt;mid-awe,&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;another approach&lt;/SPAN&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:droot (/ int int1 lst x)
  (cond ((and (not (initget 4))
              (setq int (getint "\nEnter an integer to get it's digital root: "))
         )
         (setq int1 int)
         (while (&amp;gt; (length (setq lst (vl-string-&amp;gt;list (itoa int1)))) 1)
           (setq int1 (apply '+ (mapcar '(lambda (x) (atoi (chr x))) lst)))
         )
         (princ (strcat "\n\t=&amp;gt;&amp;gt; " (itoa int) " = " (itoa int1) " digital root "))
        )
  )
  (princ)
)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2015 09:52:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667279#M140978</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-06-06T09:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667313#M140979</link>
      <description>&lt;P&gt;A couple of other functional alternatives (assuming they are fed correctly positive integers).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun droot (num)
  (if (&amp;gt; num 9)
    (droot (apply '+ (mapcar (function(lambda(x) (atoi(chr x)))) (vl-string-&amp;gt;list (itoa num)))))
    num
    ))

(defun droot2 (int1 / lst)
    (while (&amp;gt; (length (setq lst (vl-string-&amp;gt;list (itoa int1)))) 1)
           (setq int1 (apply '+ (mapcar '(lambda (x) (atoi (chr x))) lst)))
         )
  )&lt;/PRE&gt;</description>
      <pubDate>Sat, 06 Jun 2015 13:18:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667313#M140979</guid>
      <dc:creator>dbroad</dc:creator>
      <dc:date>2015-06-06T13:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667331#M140980</link>
      <description>Thank you very much. You all are awesome.</description>
      <pubDate>Sat, 06 Jun 2015 14:20:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667331#M140980</guid>
      <dc:creator>mid-awe</dc:creator>
      <dc:date>2015-06-06T14:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667334#M140981</link>
      <description>I need to do some more digging. It should be possible make any number possitive.&lt;BR /&gt;&lt;BR /&gt;Thanks again.</description>
      <pubDate>Sat, 06 Jun 2015 14:23:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667334#M140981</guid>
      <dc:creator>mid-awe</dc:creator>
      <dc:date>2015-06-06T14:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667425#M140982</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;A couple of other functional alternatives (assuming they are fed correctly positive integers).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun droot (num)
  (if (&amp;gt; num 9)
    (droot (apply '+ (mapcar (function(lambda(x) (atoi(chr x)))) (vl-string-&amp;gt;list (itoa num)))))
    num
    ))
&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Nicely done!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2015 18:10:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667425#M140982</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-06-06T18:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667438#M140983</link>
      <description>&lt;P&gt;Thanks Henrique.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/75458"&gt;@mid-awe&lt;/a&gt;&amp;nbsp; (abs num) is always positive.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2015 18:39:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667438#M140983</guid>
      <dc:creator>dbroad</dc:creator>
      <dc:date>2015-06-06T18:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667851#M140984</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/75458"&gt;@mid-awe&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;I need help with a lisp to calculate &lt;A title="Digital Root" href="http://en.wikipedia.org/wiki/Digital_root" target="_blank"&gt;digital roots&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Because of the principle of "casting out nines," I believe this approach also gives correct results:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun C:DROOT (/ int rem9)&lt;BR /&gt;&amp;nbsp; (setq&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int (getint "\nInteger to find Digital Root of: ")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rem9 &lt;STRONG&gt;(rem &lt;/STRONG&gt;(abs&lt;STRONG&gt; int&lt;/STRONG&gt;)&lt;STRONG&gt; 9)&lt;/STRONG&gt; ; (abs) needed only if User might enter negative&amp;nbsp;integer&lt;BR /&gt;&amp;nbsp; );setq&lt;BR /&gt;&amp;nbsp; (cond&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((= int 0) 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((= rem9 0) 9)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (rem9)&lt;BR /&gt;&amp;nbsp; ); cond&lt;BR /&gt;); defun&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, &lt;EM&gt;any&lt;/EM&gt; routine that uses (getint) has a &lt;EM&gt;limitation&lt;/EM&gt; to numbers between -32768 and 32767.&amp;nbsp; If you might need to find it for larger numbers, you can do it with a function with an argument, rather than using (getint) to ask for a number:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun DROOT (int / rem9)&lt;BR /&gt;&amp;nbsp; (setq rem9 (rem (abs int) 9))&lt;BR /&gt;&amp;nbsp; (cond&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((= int 0) 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((= rem9 0) 9)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (rem9)&lt;BR /&gt;&amp;nbsp; ); cond&lt;BR /&gt;); defun&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2015 02:09:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5667851#M140984</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-06-08T02:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5668258#M140985</link>
      <description>&lt;P&gt;Interesting Kent!&amp;nbsp; This should do the same thing.&amp;nbsp; I agree with the integer limitations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun droot3 (num)
  (- num (* 9 (fix (/ (- num 1) 9.0)))))&lt;/PRE&gt;
&lt;P&gt;or if you're sure that integers are input:&lt;/P&gt;
&lt;PRE&gt;(defun droot4 (num)
  (- num (* 9 (/ (- num 1) 9))))&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Jun 2015 12:15:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5668258#M140985</guid>
      <dc:creator>dbroad</dc:creator>
      <dc:date>2015-06-08T12:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5668381#M140986</link>
      <description>Wow, Kent thank you. The getint limitation did already appear to be a deal breaker. Your work around is great.&lt;BR /&gt;&lt;BR /&gt;dbroad, your latest droot4 must be as tight as it can be. Well done thank you.</description>
      <pubDate>Mon, 08 Jun 2015 13:37:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5668381#M140986</guid>
      <dc:creator>mid-awe</dc:creator>
      <dc:date>2015-06-08T13:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5668478#M140987</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;(defun DROOT (int / rem9)&lt;BR /&gt;&amp;nbsp; (setq rem9 (rem (abs int) 9))&lt;BR /&gt;&amp;nbsp; (cond&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((= int 0) 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((= rem9 0) 9)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (rem9)&lt;BR /&gt;&amp;nbsp; ); cond&lt;BR /&gt;); defun&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Well thought out!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2015 14:29:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5668478#M140987</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-06-08T14:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5669020#M140988</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/411413"&gt;@dbroad&lt;/a&gt;&amp;nbsp;FYI, your droot3 &amp;amp; droot4 both return only 0.0 when the integer is too big. Kent's version is still working with 12345678987654321.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2015 20:01:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5669020#M140988</guid>
      <dc:creator>mid-awe</dc:creator>
      <dc:date>2015-06-08T20:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5669653#M140989</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/75458"&gt;@mid-awe&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/411413"&gt;@dbroad&lt;/a&gt;&amp;nbsp;FYI, your droot3 &amp;amp; droot4 both return only 0.0 when the integer is too big. Kent's version is still working with 12345678987654321.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi mid-awe,&lt;/P&gt;
&lt;P&gt;Kent's version is still working with 12345678987654321, but errors.&lt;/P&gt;
&lt;P&gt;The digital root from 12345678987654321 is 9, not 8.0...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AutoLISP integers are numbers with values ranging from +2,147,483,647 to -2,147,483,648&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are several approaches to deal with this limitation (if you do a search you will find several), one possible method is using a string instead of an integer, of course you have to ensure that the supplied string, represents an integer...&lt;BR /&gt;To test if a string represents an integer, we can use something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun IsIntStr (str)
  (cond ((and (eq (type str) 'STR)
              (/= str "")
         )
         (vl-every (function (lambda (x) (vl-position x '(48 49 50 51 52 53 54 55 56 57)))) (vl-string-&amp;gt;list str))
        )
  )
)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A few tests to demonstrate what I'm saying&lt;/P&gt;
&lt;P&gt;_$ (defun droot_h (int_str / lst)&lt;BR /&gt;(while (&amp;gt; (length (setq lst (vl-string-&amp;gt;list int_str))) 1)&lt;BR /&gt;(setq int_str (itoa (apply '+ (mapcar '(lambda (x) (atoi (chr x))) lst))))&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;DROOT_H&lt;BR /&gt;_$ (defun DROOT2 (int / rem9)&lt;BR /&gt;&amp;nbsp; (setq rem9 (rem (abs int) 9))&lt;BR /&gt;&amp;nbsp; (cond&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((= int 0) 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((= rem9 0) 9)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (rem9)&lt;BR /&gt;&amp;nbsp; ); cond&lt;BR /&gt;); defun&lt;BR /&gt;DROOT2&lt;BR /&gt;_$ (droot2 12345678987654321)&lt;BR /&gt;8.0&lt;BR /&gt;_$ (droot_h "12345678987654321")&lt;BR /&gt;"9"&lt;BR /&gt;_$ (droot2 8888888888888888888888888888888888888888)&lt;BR /&gt;2.0&lt;BR /&gt;_$ (droot_h "8888888888888888888888888888888888888888")&lt;BR /&gt;"5"&lt;BR /&gt;_$&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2015 09:04:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5669653#M140989</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-06-09T09:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5670078#M140990</link>
      <description>Thank you Henrique. That was very informative.&lt;BR /&gt;&lt;BR /&gt;While test the various solutions, I failed to use the same number for all tests and so I did not even notice the error. Simply looking for a returned number other than 0.0 was a bad idea. I greatly appreciate you help.&lt;BR /&gt;&lt;BR /&gt;Thanks again.</description>
      <pubDate>Tue, 09 Jun 2015 13:37:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5670078#M140990</guid>
      <dc:creator>mid-awe</dc:creator>
      <dc:date>2015-06-09T13:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5670092#M140991</link>
      <description>&lt;P&gt;You're welcome, mid-awe!&lt;BR /&gt;&lt;BR /&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2015 13:45:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5670092#M140991</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-06-09T13:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5670373#M140992</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/75977"&gt;@hmsilva&lt;/a&gt; wrote:&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;&lt;SPAN&gt;Kent's version is still working with 12345678987654321, but errors.&lt;/SPAN&gt;&lt;BR /&gt;
&lt;P&gt;....&lt;BR /&gt;To test if a string represents an integer, we can use something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun IsIntStr (str)
  (cond ((and (eq (type str) 'STR)
              (/= str "")
         )
         (vl-every (function (lambda (x) (vl-position x '(48 49 50 51 52 53 54 55 56 57)))) (vl-string-&amp;gt;list str))
        )
  )
)&lt;/PRE&gt;
&lt;P&gt;....&lt;SPAN style="font-size: 12.88px; line-height: 13.8px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I should have realized that there's a limit to the size of numbers AutoLisp [or is it a limitation in&amp;nbsp;Auto&lt;EM&gt;CAD&amp;nbsp;&lt;/EM&gt;?] can deal with, not just in (getint) functions, though the overall limit is at least greater than (getint)'s limit. &amp;nbsp;Given that, if such large numbers are possible, the (rem) approach must give way to an&amp;nbsp;adding-up approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A somewhat more concise way to configure the same test:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun IsStrInt (str)&lt;BR /&gt;&amp;nbsp; (and&lt;BR /&gt;&amp;nbsp; &amp;nbsp; (= (type str) 'STR)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; (/= str "")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; (vl-every '(lambda (x) (&amp;lt; 47 x 58)) (vl-string-&amp;gt;list str))&lt;BR /&gt;&amp;nbsp; )&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: &amp;nbsp;There's &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/separe-and-add-number-string/m-p/1861730/highlight/true#M231245" target="_self"&gt;another thread&lt;/A&gt;&amp;nbsp;on the same topic, and it&amp;nbsp;may be worth comparing approaches there to those add-up suggestions earlier on this one.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2015 16:27:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5670373#M140992</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-06-09T16:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5670422#M140993</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;I should have realized that there's a limit to the size of numbers AutoLisp [or is it a limitation in&amp;nbsp;Auto&lt;EM&gt;CAD&amp;nbsp;&lt;/EM&gt;?] can deal with, not just in (getint) functions, though the overall limit is at least greater than (getint)'s limit.&amp;nbsp;&amp;nbsp;...&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://docs.autodesk.com/ACD/2014/ITA/index.html?url=files/GUID-EF6114FC-F1E4-4C71-91CC-07D01E6C8ABB.htm,topicNumber=d30e557432" target="_blank"&gt;integers are 32-bit signed numbers.&lt;/A&gt;&amp;nbsp;and have limitation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2015 16:29:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5670422#M140993</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-06-09T16:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: digital root?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5670492#M140994</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;EDIT: &amp;nbsp;There's &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/separe-and-add-number-string/m-p/1861730/highlight/true#M231245" target="_self"&gt;another thread&lt;/A&gt;&amp;nbsp;on the same topic, and it&amp;nbsp;may be worth comparing approaches there to those add-up suggestions earlier on this one.&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sorry, but &lt;SPAN class="hps"&gt;I could&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;no longer&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;edit my&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;previous message&lt;/SPAN&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/separe-and-add-number-string/m-p/1861731#M231246" target="_blank"&gt;Tim Willey's &lt;SPAN class="hps"&gt;approach&lt;/SPAN&gt;, it's similar to&amp;nbsp;mine.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Henrique&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2015 17:09:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/digital-root/m-p/5670492#M140994</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-06-09T17:09:58Z</dc:date>
    </item>
  </channel>
</rss>

