Fixed Point Maths

version 5 by Michael Callaghan

  • Home page
  • Beginning
  • Previous
  • Next



  • Section 4 - Square roots

    To decide which real number is the real square root of (N - a real number):
        if N real equals 0.0000:
            decide on 0.0000;
        if N is real less than 0.0000:
            decide on 0.0000;
        let result be N real divided by 2.0000;
        let previous be result;
        repeat with X running from 1 to 50:
            let temp1 be result real divided by 2.0000;
            let temp2 be result real times 2.0000;
            let temp2 be N real divided by temp2;
            let result be temp1 real plus temp2;
            let factor be result real minus previous;
            let factor be the absolute value of factor;
            if factor is real less than 0.0002:
                decide on result;
            let previous be result;
        decide on result.

    To decide which real number is the real square root of (N - a number):
        let temp be N as a fixed point number;
        decide on the real square root of temp.