namespace Chernobyl.Calculator { /// /// A version of an ICalculator that can perform /// calculations on doubles. /// public struct DoubleCalculator : ICalculator { /// /// Adds one double to another. /// /// The left side of the addition operation. /// The right side of the addition operation. /// The result of the addition. public double Add(double left, double right) { return left + right; } /// /// Subtracts one double from another. /// /// The left side of the subtraction operation. /// The right side of the subtraction operation. /// The result of the subtraction. public double Subtract(double left, double right) { return left - right; } /// /// Divides two doubles. /// /// The dividend. /// The divisor. /// The result of the divide. public double Divide(double dividend, double divisor) { return dividend / divisor; } /// /// Multiplies two doubles together. /// /// The left side of the multiplication operation. /// The right side of the multiplication operation. /// The result of the multiplication. public double Multiply(double left, double right) { return left * right; } /// /// Negates a double. /// /// The double to negate. /// The result of the negation. public double Negate(double item) { return -item; } /// /// Compares two doubles. /// /// The left side of the comparison operation. /// The right side of the comparison operation. public bool Compare(double left, double right) { return (left == right); } } }