/// <summary> /// Performs banker's rounding on the specified argument. /// </summary> /// <param name="value">The value to round.</param> /// <returns>Result of rounding.</returns> public static SqlExpression BankersRound(SqlExpression value) { var mainPart = 2 * SqlDml.Floor((value + 0.5) / 2); var extraPart = SqlDml.Case(); extraPart.Add(value - mainPart > 0.5, 1); extraPart.Else = 0; return(mainPart + extraPart); }
public static SqlExpression MathFloorDouble( [Type(typeof(double))] SqlExpression d) { return(SqlDml.Floor(d)); }
public static SqlExpression MathFloorDecimal( [Type(typeof(decimal))] SqlExpression d) { return(SqlDml.Floor(d)); }
public static SqlExpression MathFloorDecimal( [Type(typeof(decimal))] SqlExpression d) { return(TryCastToDecimalPS(SqlDml.Floor(d), 28, 0)); }