Table of Contents

Class Sqrt

Namespace
YndigoBlue.Velocity.Functions
Assembly
YndigoBlue.Velocity.dll

Represents the SQRT (square root) mathematical function that returns the principal square root of a number.

public class Sqrt : Function, ICheckItem, IDefaultItem, IFilterItem, IElement
Inheritance
Sqrt
Implements

Remarks

The SQRT function calculates the square root of a non-negative number. The input value must be greater than or equal to zero; negative values will produce an error in most databases. This is useful for distance calculations, statistical operations, and geometric computations.

Examples

Calculate the square root of each variance value in a statistics table:

var schema = manager.LoadSchema("statistics");
var stats = schema["stats"];

var query = new Query()
    .Select([ stats["id"], new Expression("std_dev", new Sqrt(stats["variance"])) ])
    .From(stats);

var results = manager.Retrieve(query);

Use the typed Column constructor when working with a pre-resolved column variable:

var schema = manager.LoadSchema("statistics");
var stats = schema["stats"];
Column varianceColumn = stats["variance"];

var query = new Query()
    .Select([ stats["id"], new Expression("std_dev", new Sqrt(varianceColumn)) ])
    .From(stats);

var results = manager.Retrieve(query);

Compute the square root of a hard-coded numeric literal:

// Integer literal: SQRT(25) → 5
var sqrtInt = new Sqrt(25);

// Double literal: SQRT(2.0) → ~1.414
var sqrtDouble = new Sqrt(2.0);

Constructors

Sqrt(IEnumerable<IElement>)

Initializes a new instance of SQRT for multiple elements.

Sqrt(double)

Initializes a new instance of SQRT for a double literal value.

Sqrt(int)

Initializes a new instance of SQRT for an integer literal value.

Sqrt(IElement)

Initializes a new instance of SQRT for a single element.

Sqrt(Column)

Initializes a new instance of SQRT for a column.