Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #27049

Re: Double multiplication

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: Double multiplication
Date 2013-11-28 15:51 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2013Nov28.165122@mips.complang.tuwien.ac.at> (permalink)
References <l72gu7$qj0$1@odin.sdf-eu.org> <2013Nov26.171319@mips.complang.tuwien.ac.at> <52966559$0$15971$e4fe514c@news2.news.xs4all.nl>

Show all headers | View raw


Hans Bezemer <the.beez.speaks@gmail.com> writes:
>Anton Ertl wrote:
>
> 
>> Concerning the implementation, I'll have a go at it:
>> 
>> : d* { al ah bl bh -- cl ch }
>>   \ (2^m*ah+al)+(2^m*bh+bl) =
>>   \ 2^(2*m)*ah*bh+2^m*(ah*bl+al*bh)+al*bl
>>   \ take this modulo 2^(2*m), making ah*bh irrelevant
>>   al bh * ah bl * + 0 swap
>>   al bl um* d+ ;
>Or, for those who can't really stand unnecessary locals:
>
>: ud* >r swap >r over over um* rot r> * + rot r> * + ; ( ud1 ud2 -- ud3)

Which shows that the D+ is unnecessary, because the low cell of one
addend is 0.  Let's do this with locals:

: d* { al ah bl bh -- cl ch }
  al bl um* al bh * + ah bl * + ;

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2013: http://www.euroforth.org/ef13/

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Double multiplication David Meyer <papa@sdf.org> - 2013-11-26 16:06 +0000
  Re: Double multiplication anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-11-26 16:13 +0000
    Re: Double multiplication "Alex McDonald" <blog@rivadpm.com> - 2013-11-26 22:59 +0000
    Re: Double multiplication Hans Bezemer <the.beez.speaks@gmail.com> - 2013-11-27 22:34 +0100
      Re: Double multiplication anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-11-28 15:51 +0000
  Re: Double multiplication mhx@iae.nl - 2013-11-26 10:14 -0800
    Re: Double multiplication "Ed" <invalid@invalid.com> - 2013-12-01 23:41 +1100
      Re: Double multiplication mhx@iae.nl - 2013-12-02 02:23 -0800
        Re: Double multiplication "Ed" <invalid@invalid.com> - 2013-12-05 22:19 +1100
        Re: Double multiplication Hans Bezemer <the.beez.speaks@gmail.com> - 2013-12-05 13:14 +0100
          Re: Double multiplication Coos Haak <chforth@hccnet.nl> - 2013-12-06 00:16 +0100
          Re: Double multiplication "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2013-12-05 21:24 -0500
  Re: Double multiplication albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-26 20:20 +0000
    Re: Double multiplication "Elizabeth D. Rather" <erather@forth.com> - 2013-11-26 11:43 -1000

csiph-web