Results 1 to 4 of 4

Thread: square root

  1. #1
    Join Date
    Jul 2007
    Posts
    137
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default square root

    here is a simple procedure to get a square root, it only works to a certain extent, i will fix that later...

    SCAR Code:
    program squareroot;


    const
      numbertosquare = 3;


    function squarerootnumber(number : integer) : extended;
    var
      guess : integer;
      step1, guess2, step2, guess3, step3, guess4 : extended;
    begin
      guess:=  1;
      step1:= number/guess;
      guess2:= step1 + guess/2;
      step2:= number/guess2;
      guess3:= step2 + number/2;
      step3:= number/guess3;
      guess4:= step3 + guess3/2;
      result:= guess4;
      writeln(' ');
      writeln('The square root is ' + Floattostr(result));
      writeln('Remember this is an estimation');
      writeln('the generated number will differ from actual answer');
      writeln('In many cases it will be far off... ');
      writeln('I might improve the method later! :D');
      writeln(' ');
      writeln(' ');
      result:= 0;
    end;

    begin
      squarerootnumber(numbertosquare);
    end.
    Do not propose an idea of peculation without evidence of such action.

    http://cashcrate.com/704591 click here and make money!

  2. #2
    Join Date
    Feb 2006
    Location
    Berkeley, CA
    Posts
    1,837
    Mentioned
    52 Post(s)
    Quoted
    60 Post(s)

    Default

    Code:
    Sqrt(3)
    Or are you just doing it to see if you can? With that method, just make it repeat until the change in the number is less than a maximum error value.

  3. #3
    Join Date
    Jul 2007
    Posts
    137
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    just messing around with scar
    Do not propose an idea of peculation without evidence of such action.

    http://cashcrate.com/704591 click here and make money!

  4. #4
    Join Date
    Jun 2007
    Location
    Canuckistan
    Posts
    306
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Personally, I have never figured out how to make a square root function from simple math, well done.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Square Root Symbol Solver
    By smithsps in forum Research & Development Lounge
    Replies: 5
    Last Post: 05-24-2008, 01:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •