ChensHelpers
Chen.Helpers.MathHelpers.Arithmetic
Arithmetic.SafeDivide(float, float, float) Method
Performs division with a safety check when the divisor is 0.
The parameter fallbackResult will be returned instead if the divisor is 0.
public static float SafeDivide(this float dividend, float divisor, float fallbackResult=float.PositiveInfinity);
Parameters
dividend
System.Single
The number being divided
divisor
System.Single
The number that will divide the dividend
fallbackResult
System.Single
Return value if the divisor is 0
Returns
System.Single
The quotient or the fallbackResult