🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.asm370
Article #435

Doubleword arithmetic

#435
From: Steve Bacher
Date: Wed, 26 Sep 1990 14:55
30 lines
2016 bytes
>From: Bahri Bora BALI AG <OPRJ36%TREARN.BITNET@cunyvm.cuny.edu>
>Subject: DoubleWord Number to be in a calculation and displayed

>Hello Steve. I got your sample from Asm list. I've been wondering how
>would I make some calculation with large numbers and display them by
>Assembler. I tried your sample code but I didn't succeed to get the
>result that I've been expecting. For example, I want to multiply
>'1234567890' (doubleword) number by '123456'. By your method in your
>sample, how could I do this ? Could you show me any way to do this?
>I am sending my sample (your modified code, by me) to you. Thank you
>very very much for your helps. Happy days.

You're talking about large-precision integer arithmetic now, and this gets
into some tricky areas.  Since a doubleword integer, when multiplied by
another integer, can easily result in a value larger than 64 bits, this is
not a trivial task,

Even if you use a straightforward grammar-school-arithmetic approach, there
are a number of special cases wrt signs and overflow that need to be kept
in mind.  You should be sure to exercise your code with a lot of well-
thought-out test cases.  Otherwise bugs will pop up and bite you when
you least expect them.  (Take it from any number of Lisp implementations.)

If you limit yourself to non-negative fullword*fullword=doubleword
calculations, you should be able to use the straight fullword multiply
instructions.

Hope this helps (and doesn't discourage you too much),

						- SEB
Technical Details
Message-ID: <9009261708.AA13896@ucbvax.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ucbvax!support2.draper.COM!seb1525

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ucbvax!support2.draper.COM!seb1525
From: seb1525@support2.draper.COM (Steve Bacher)
Newsgroups: comp.lang.asm370
Subject: Doubleword arithmetic
Message-ID: <9009261708.AA13896@ucbvax.Berkeley.EDU>
Date: 26 Sep 90 14:55:37 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: IBM 370 Assembly Programming Discussion List
              <ASM370@OHSTVMA.BITNET>
Distribution: inet
Organization: The Internet
Lines: 30