Question: I've got an 8-byte fixed-point number using longs, with a constant denominator of (1 << 24). How do I do division of two Fixed8 values? Since I'm using C#, I can't simply cast to a larger integer. Or am I thinking too much in the language?

Thanks.

```
public struct Fixed8
{
    private long _numerator;
    public const long DENOMINATOR = 1 << 24;
}

```

Answer: 
Here's an approach that keeps all the calculations in `long`s. It might not be quicker, though; I haven't measured.

```
public struct Fixed8
{
    public Fixed8(double value)
    {
        _numerator = (long)(value * DENOMINATOR);
    }

    private long _numerator;
    public const long DENOMINATOR = 1 << 24;

    public static Fixed8 operator /(Fixed8 a, Fixed8 b)
    {
        long remainder;
        long quotient = Math.DivRem(a._numerator, b._numerator, out remainder) * DENOMINATOR;

        long morePrecision = remainder * DENOMINATOR / b._numerator;

        return new Fixed8 { _numerator = quotient + morePrecision };
    }
}

```
```
public long Division()
{
    long result = _numerator / DENOMINATOR;
    return result;
}

```