Fixed Point Maths

version 5 by Michael Callaghan

  • Home page
  • Beginning
  • Previous
  • Next

  • Section 4 - Absolute value of a fixed point number (converts negatives to positives)

    To decide which real number is the absolute value of (N - a real number):
        let temp1 be the whole part of N;
        let temp2 be the fractional part of N;
        if N is negative:
            let temp1 be the absolute value of temp1;
            let temp2 be the absolute value of temp2;
        let result be the real number with whole part temp1 fractional part temp2;
        decide on result.