Reference > Functions > Mathematical
ATan
- 2005
- 2008
- 2012
- 2014
- 2016
- 2017
- 2019
- 2022
- 2005, 2008, 2012, 2014, 2016, 2017, 2019, 2022
ATan (Arctangent) Mathematical Function
Use the ATan
function to return the square root of the specified expression.
Syntax
db.fx.ATan({expression})
Arguments
- expression
- – The value to use in the arctangent calculation.
Returns
float
Examples
Select Statement
Select the square root of a product's weight (which is nullable in the database).
float? result = db.SelectOne(
db.fx.ATan(dbo.Product.Weight)
)
.From(dbo.Product)
.Where(dbo.Product.Weight > 0 & dbo.Product.Weight < 1)
.Execute();
Where Clause
Select the square root of a product's depth (which is nullable in the database) where the depth is between 0 and 1.
float? result = db.SelectOne(
db.fx.ATan(dbo.Product.Depth)
)
.From(dbo.Product)
.Where(dbo.Product.Depth > 0 & dbo.Product.Depth < 1)
.Execute();
Order By Clause
Select and order by the square root of a product's depth.
IEnumerable<Product> result = db.SelectMany<Product>()
.From(dbo.Product)
.OrderBy(db.fx.ATan(dbo.Product.Depth).Desc())
.Execute();
Group By Clause
Select product details grouped by product category and square root of the product's depth.
IEnumerable<dynamic> results = db.SelectMany(
dbo.Product.ProductCategoryType,
db.fx.ATan(dbo.Product.Depth).As("calculated_value")
)
.From(dbo.Product)
.GroupBy(
dbo.Product.ProductCategoryType,
db.fx.ATan(dbo.Product.Depth)
)
.Execute();
Having Clause
Select the ids of all products, grouped by product category type having an arctangent of the product's depth less than .5.
IEnumerable<ProductCategoryType?> results = db.SelectMany(
dbo.Product.ProductCategoryType
)
.From(dbo.Product)
.GroupBy(
dbo.Product.ProductCategoryType,
db.fx.ATan(dbo.Product.Depth)
)
.Having(
db.fx.ATan(dbo.Product.Depth) < .5f
)
.Execute();