Wanted: Efficient Algorithm to Square an Integer Number

03062019, 11:47 PM
Post: #5




RE: Wanted: Efficient Algorithm to Square an Integer Number
Not the best method, but this can be done entirely with integer operations and no multiplications whatsoever (lines 17 & 18 and lines 20 & 21 are shift left and shift right operations, respectively).
More details in this old forum thread: OT: primitive mult/div algorithms 00 { 43Byte Prgm } 01▸LBL "ISQ" 02 ABS 03 0 04 STO 00 05 X<>Y 06 ENTER 07 ENTER 08▸LBL 00 09 CF 00 10 0 11 BIT? 12 SF 00 13 R↓ 14 X<>Y 15 FS? 00 16 STO+ 00 17 1 18 ROTXY 19 X<>Y 20 2 21 BASE÷ 22 X>0? 23 GTO 00 24 RCL 00 25 END 42 XEQ ISQ > 1764 

« 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)