Useful Functions

version 1 by ShadowChaser

  • Home page
  • Beginning
  • Previous



  • Section 7 - Square Root

    To decide what number is the square_root of (x - a number):
        if x is 0 begin;
            decide on 0;
        otherwise;
         let guess be (x / 2) + 1;
         let guess2 be x / guess;
         let guess2 be guess + guess2;
         let guess2 be guess2 / 2;
    while guess2 < guess begin;
    let guess be guess2;
    let guess2 be x / guess;
         let guess2 be guess + guess2;
         let guess2 be guess2 / 2;
         end while;
    decide on guess;
        end if.

            
    Useful Functions ends here.