Re: [colorforth] Euler Project Problems.
- Subject: Re: [colorforth] Euler Project Problems.
- From: "Ray St. Marie" <ray.stmarie@xxxxxxxxx>
- Date: Mon, 19 May 2008 23:59:33 -0600
Dear Albert,
I added a " dup ." after C@ below just to see what was being sent to
the word ASCII->BINARY.
Using the "FACTORISE 123456" example DUP . prints 49 144 which I find
odd because I only asked to print one number after C@ which I assume
is 49, but then I suppose that makes 144 one of the factors. I could
be wrong and often am.
: READ.DECIMAL.NUMBER           \ ( --- >> "number.string" )
     1 TO PRECISION             \ Reset precision
     BL WORD                    \ get from input
     COUNT                      \ String.address length
     DUP 0= ABORT" Please input a number"
     DUP length !               \ Remember!
     0 DO                       \  Convert each digit
          C@ dup . \ C@+ is this a typing error? RAS 080519
          ASCII->BINARY
          I num digit!          \  to binary in number.
     LOOP DROP                  \  Drop string address.
     10 current.base digit!     \ Start with decimal
     0 current.base CELL+ !     \ Guard decimal for the overflow
;
-- 
Raymond St. Marie ii,
colorforthray.info
---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com