(Skip to the last paragraph if you don't want the context)
I'm working on a program where I need to deal with big numbers (10,000,000+), and I need fractions. Computers lose accuracy when doing mathematical operations on fractions the bigger the fraction is, due to the way numbers are stored.
I'm working on a data type that uses a 64-bit integer and a 32-bit floating point number. I'm currently working on implementing the binary operators for this data type and I've hit a major roadblock.
I'm storing the number, which I'll call $BigNumber$ for the remainder of this question, such that we have two parts: $a$ and $b$, where $a$ is an integer and $b$ is a fraction between $0$ and $1$. When multiplying $BigNumber$ $x$ with $BigNumber$ $y$, we have $a$, $b$, $c$ and $d$, where $a$ is $BigNumber$ $x$'s integer, $b$ is $BigNumber$ $x$'s fraction, $c$ is $BigNumber$ $y$'s integer and $d$ is $BigNumber$ $z$'s fraction. I can add two integers together, add two fractions together, but cannot add any integer to any fraction (this will make me lose accuracy).
I cannot use any operator other than the binary operators (for performance, the program is a videogame).
I'm currently stuck on calculating the division operator. I've got multiplication, but even though $\frac{a}{b} \equiv a \times \frac{1}{b}$, it still has a division operation, which is what I'm trying to implement.
Basically solve $\frac{a+b}{c+d}$ such that you can only have one number on the denomator of any fraction. You can only use binary operators (+, -, $\times$, $\div$) and % (remainder of a division, for example $5$ % $3 = 2$). $a, c$ $\in \Bbb Z$, $b$ and $d$ are a value between $0$ and $1$