Wanted: Efficient Algorithm to Square an Integer Number

03082019, 12:26 AM
Post: #8




RE: Wanted: Efficient Algorithm to Square an Integer Number
(03062019 11:24 PM)Thomas Okken Wrote: When squaring a number, you can save one multiplication here, since a_low * b_high and a_high * b_low are the same in this case. The difference is going to be even more pronounced if you're implementing 32bit multiplication on an 8bit CPU, and I imagine similar optimizations come into play when implementing it in hardware. Exactly, Thomas! Back when HP's 9836 was a potent workstation (8MHz 68000!) I benchmarked it by having it compute Ackerman's function of (4,2), which is 2^65536  3. In Rocky Mountain BASIC. The initial version took about 45 minutes but changing to use the symmetries of squaring cut that almost in half. Of course, the same program on a modern PC takes a small fraction of a second, to say nothing of optimized assembly... 

« Next Oldest  Next Newest »

Messages In This Thread 
Wanted: Efficient Algorithm to Square an Integer Number  Martin Hepperle  03062019, 03:54 PM
RE: Wanted: Efficient Algorithm to Square an Integer Number  ijabbott  03062019, 08:10 PM
RE: Wanted: Efficient Algorithm to Square an Integer Number  Martin Hepperle  03072019, 02:52 PM
RE: Wanted: Efficient Algorithm to Square an Integer Number  David Hayden  03062019, 08:16 PM
RE: Wanted: Efficient Algorithm to Square an Integer Number  Thomas Okken  03062019, 11:24 PM
RE: Wanted: Efficient Algorithm to Square an Integer Number  Jim Horn  03082019 12:26 AM
RE: Wanted: Efficient Algorithm to Square an Integer Number  Gerson W. Barbosa  03062019, 11:47 PM
RE: Wanted: Efficient Algorithm to Square an Integer Number  Druzyek  03072019, 12:10 AM

User(s) browsing this thread: 1 Guest(s)