# Fixed Point Maths

## version 5 by Michael Callaghan

Chapter 8 - Division

Section 1 - Division of one fixed point number by another fixed point number

To decide which real number is (A - a real number) real divided by (B - a real number):
let temp1 be the aggregate of A;
let temp1 be the absolute value of temp1;
let temp2 be the aggregate of B;
let temp2 be the absolute value of temp2;
let result_int be temp1 divided by temp2;
let result_dec be 0;
let temp be the remainder after dividing temp1 by temp2;
let Placeholder be Divisor divided by 10;
repeat with X running from 1 to Precision:
let temp be temp times 10;
let temp1 be temp divided by temp2;
let temp1 be temp1 times Placeholder;
let result_dec be result_dec plus temp1;
let temp be the remainder after dividing temp by temp2;
let Placeholder be Placeholder divided by 10;
let temp be temp times 10;
let temp1 be temp divided by temp2;
if temp1 is greater than 4:
let result_dec be result_dec plus 1;
let result be the real number with whole part result_int fractional part result_dec;
if A is negative:
let result be the reverse of result;
if B is negative:
let result be the reverse of result;
otherwise:
if B is negative:
let result be the reverse of result;
decide on result.