Math Canonical Functions

 

Entity SQL includes math canonical functions.

The following table shows the math Entity SQL canonical functions.

Function

Description

Abs(value)

Returns the absolute value of value.

Arguments

An Int16, Int32, Int64, Byte, Single, Double, and Decimal.

Return Value

The type of value.

Example

Abs(-2)

Ceiling(value)

Returns the smallest integer that is not less than value.

Arguments

A Single, Double, and Decimal.

Return Value

The type of value.

Example

Floor(value)

Returns the largest integer that is not greater than value.

Arguments

A Single, Double, and Decimal.

Return Value

The type of value.

Example

Power(value, exponent)

Returns the result of the specified value to the specified exponent.

Arguments

value: An Int32, Int64, Double, or Decimal.

exponent: An Int64, Double, or Decimal.

Return Value

The type of value.

Example

Power(748.58,2)

Round(value)

Returns the integer portion of value, rounded to the nearest integer.

Arguments

A Single, Double, and Decimal.

Return Value

The type of value.

Example

Round(748.58)

Round(value, digits)

Returns the value, rounded to the nearest specified digits.

Arguments

value: Double or Decimal.

digits: Int16 or Int32.

Return Value

The type of value.

Example

Round(748.58,1)

Truncate(value, digits)

Returns the value, truncated to the nearest specified digits.

Arguments

value: Double or Decimal.

digits: Int16 or Int32.

Return Value

The type of value.

Example

Truncate(748.58,1)

These functions will return null if given null input.

Equivalent functionality is available in the Microsoft SQL Client Managed Provider. For more information, see SqlClient for Entity Framework Functions.

Show: