public static double GetTolerance(double experimental, double theoretical, ToleranceUnit type) { switch (type) { case ToleranceUnit.MMU: return (experimental - theoretical)*1000.0; case ToleranceUnit.PPM: return (experimental - theoretical)/theoretical*1e6; default: return experimental - theoretical; } }