Wanted: Efficient Algorithm to Square an Integer Number
|
03-08-2019, 12:26 AM
Post: #8
|
|||
|
|||
RE: Wanted: Efficient Algorithm to Square an Integer Number
(03-06-2019 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 32-bit multiplication on an 8-bit 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 - 03-06-2019, 03:54 PM
RE: Wanted: Efficient Algorithm to Square an Integer Number - ijabbott - 03-06-2019, 08:10 PM
RE: Wanted: Efficient Algorithm to Square an Integer Number - Martin Hepperle - 03-07-2019, 02:52 PM
RE: Wanted: Efficient Algorithm to Square an Integer Number - David Hayden - 03-06-2019, 08:16 PM
RE: Wanted: Efficient Algorithm to Square an Integer Number - Thomas Okken - 03-06-2019, 11:24 PM
RE: Wanted: Efficient Algorithm to Square an Integer Number - Jim Horn - 03-08-2019 12:26 AM
RE: Wanted: Efficient Algorithm to Square an Integer Number - Gerson W. Barbosa - 03-06-2019, 11:47 PM
RE: Wanted: Efficient Algorithm to Square an Integer Number - Druzyek - 03-07-2019, 12:10 AM
|
User(s) browsing this thread: 1 Guest(s)