Reference > Functions > Mathematical

ASin

  • 2005, 2008, 2012, 2014, 2016, 2017, 2019, 2022

ASin (Arcsine) Mathematical Function

Use the ASin function to return the arcsine of the specified expression.

Syntax

db.fx.ASin({expression})

Arguments

expression
The value to use in the arcsine calculation.

Returns

float

Examples

Select Statement

Select the arcsine of a product's weight (which is nullable in the database). Note the where clause on this statement to ensure successful execution.

float? result = db.SelectOne(
        db.fx.ASin(dbo.Product.Weight)
    )
    .From(dbo.Product)
    .Where(dbo.Product.Weight > 0 & dbo.Product.Weight < 1)
    .Execute();

Where Clause

Select the arcsine of a product's depth (which is nullable in the database). Note the where clause on this statement to ensure successful execution.

float? result = db.SelectOne(
        db.fx.ASin(dbo.Product.Depth)
    )
    .From(dbo.Product)
    .Where(dbo.Product.Depth > 0 & dbo.Product.Depth < 1)
    .Execute();

Order By Clause

Select and order by the arcsine of a product's depth.

IEnumerable<Product> result = db.SelectMany<Product>()
    .From(dbo.Product)
    .Where(dbo.Product.Depth > 0 & dbo.Product.Depth < 1)
    .OrderBy(db.fx.ASin(dbo.Product.Depth).Desc())
    .Execute();

Group By Clause

Select product details grouped by product category and arcsine of the product's depth.

IEnumerable<dynamic> results = db.SelectMany(
        dbo.Product.ProductCategoryType,
        db.fx.ASin(dbo.Product.Depth).As("calculated_value")
    )
    .From(dbo.Product)
    .Where(dbo.Product.Depth > 0 & dbo.Product.Depth < 1)
    .GroupBy(
        dbo.Product.ProductCategoryType,
        db.fx.ASin(dbo.Product.Depth)
    )
    .Execute();

Having Clause

Select the ids of all products, grouped by product category type having an arcsine of the product's height greater than 1.

IEnumerable<ProductCategoryType?> results = db.SelectMany(
        dbo.Product.ProductCategoryType
    )
    .From(dbo.Product)
    .Where(dbo.Product.Height > 0 & dbo.Product.Height < 1)
    .GroupBy(
        dbo.Product.ProductCategoryType,
        db.fx.ASin(dbo.Product.Height)
    )
    .Having(
        db.fx.ASin(dbo.Product.Height) < .5f
    )
    .Execute();
Previous
ACos

© 2024 dbExpression. All rights reserved.