home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 116,468 of 117,927   
   albert@spenarnc.xs4all.nl to Anton Ertl   
   Re: Best Euler #13 =?UTF-8?B?c29sdXRpb24   
   05 May 24 20:42:47   
   
   In article <2024May5.163254@mips.complang.tuwien.ac.at>,   
   Anton Ertl  wrote:   
   >melahi_ahmed@yahoo.fr (Ahmed) writes:   
   >>Anton Ertl wrote:   
   >>>Does this program try to perform the   
   >>>addition rowwise rather than columnwise?   
   >>   
   >>The sum is done as we do it manually with pencil.   
   >>the array: sum works as an accumulator.   
   >>we add a 50-digit number at once.   
   >   
   >But when I sum multiple numbers by hand, I don't use an accumulator   
   >for whole numbers.  I add up all the digits of one column and the   
   >carry from the previous digit colum (which is in the range 0..99 in   
   >the Euler #13 case).  In the Euler #13 case this produces a number in   
   >the range 0..999, and then I do the 10 /mod (via # in my program),   
   >with the remainder being the result digit for the column, and the   
   >quotient (in the range 0..99) being the carry for the next column.   
      
   The problem should include some numbers less that 50 digits,   
   then use your method, running in a 16 bit Forth.   
   That would at least more interesting than resorting to infinite   
   precision numbers. At the time it was intended that the numbers   
   would overflow precision.   
      
   >- anton   
      
   Groetjes Albert   
   --   
   Don't praise the day before the evening. One swallow doesn't make spring.   
   You must not say "hey" before you have crossed the bridge. Don't sell the   
   hide of the bear until you shot it. Better one bird in the hand than ten in   
   the air. First gain is a cat purring.            - the Wise from Antrim -   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca