1

Closed

Prevent divide by zero in AbstractRational.cs

description

Current code repeats (this.Numerator != 0 && this.Numerator != 0)
 
Most likely this should be
 
        /// <summary>
        /// Returns the Rational as an Integer
        /// </summary>
        /// <returns>Int</returns>
        public int ToInt()
        {
            if (this.Numerator != 0 && this.Denominator != 0)
            {
                return Convert.ToInt32(Math.Round(Convert.ToDouble(this.Numerator) / Convert.ToDouble(this.Denominator)));
            }
            else
            {
                return 0;
            }
        }
Closed Jul 24, 2011 at 8:39 PM by Taasss
Thanks, I've fixed this in my local copy and will upload shortly.I appreciate the feedback.

comments