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