System.Math Methods

LINQ to SQL does not support the following Math methods.

Differences from .NET

The .NET Framework has different rounding semantics from SQL Server. The Round method in the .NET Framework performs Banker's rounding, where numbers that ends in .5 round to the nearest even digit instead of to the next higher digit. For example, 2.5 rounds to 2, while 3.5 rounds to 4. (This technique helps avoid systematic bias toward higher values in large data transactions.)

In SQL, the ROUND function instead always rounds away from 0. Therefore 2.5 rounds to 3, contrasted with its rounding to 2 in the .NET Framework.

LINQ to SQL passes through to the SQL ROUND semantics and does not try to implement Banker's rounding.

See also