public static LFloat RoundIfNear(LFloat val, LFloat roundDist) { var roundVal = LMath.Round(val); var diff = LMath.Abs(val - roundVal); if (diff < roundDist) { return(roundVal); } return(val); }