Dividing a BigIntegers to return double

Viewed 3136

I want to calculate the slope of a line.

public sealed class Point
{
    public System.Numerics.BigInteger x = 0;
    public System.Numerics.BigInteger y = 0;

    public double CalculateSlope (Point point)
    {
        return ((point.Y - this.Y) / (point.X - this.X));
    }
}

I know that BigInteger has a DivRem function that returns the division result plus the remainder but am not sure how to apply it to get a double. The numbers I'm dealing with are far far beyond the range of Int64.MaxValue so the remainder itself could be out of range to calculate by conventional division.

EDIT: Not sure if it helps but I'm dealing with only positive integers (>=1).

IMPORTANT: I only need a few decimal points of precision (5 should be good enough for my purpose).

3 Answers
Related