sallam-ahmed / Polynomial-Calculator

Data Structure 2015 Course Project
Apache License 2.0
0 stars 3 forks source link

longDiv bug #19

Closed khaledkee closed 8 years ago

khaledkee commented 8 years ago

If the second polynomial had larger degree than the first, dr (Degree of reminder) and dq (degree of quotient) will be negative and will cause OutOfRange exception.

khaledkee commented 8 years ago

The quotient is obviously null polynomial, I mean 0. The modulus is obviously the first polynomial. So I suppose this would fix the bug:

if(dD > dN)
{
    if(modulus)return N;
    else return new Complex[1];
}