| ??? 03/13/03 13:21 Read: times |
#41423 - RE: Square root algo Responding to: ???'s previous message |
Some years ago I wrote a routine to determine the square root of a long undigned integer N (4 bytes), being the result a short unsigned integer n (2 bytes). It is based on a succesive approximation algorithm, similar to the one used in ADCs. It begins trying n=8000h (1000000000000000b), its square is computed and compared to N. Depending on which is greater (N or n*n), the '1' is left or removed. In any case, a new '1' is ORed in the 15th bit (?100000000000000), and so on, until the LSB in n is reached. The code is relatively fast.
Alfredo. |
| Topic | Author | Date |
| Square root algo | 01/01/70 00:00 | |
| RE: Square root algo | 01/01/70 00:00 | |
| RE: Square root algo | 01/01/70 00:00 | |
| RE: Square root algo | 01/01/70 00:00 | |
| RE: Square root algo | 01/01/70 00:00 | |
| RE: Square root algo | 01/01/70 00:00 | |
| RE: Square root algo | 01/01/70 00:00 | |
| RE: Square root algo | 01/01/70 00:00 | |
| RE: Square root algo | 01/01/70 00:00 | |
RE: Square root algo | 01/01/70 00:00 |



