Logo

POWER

Updated 2023-10-13 20:39:52.133000

Syntax

SELECT [westclintech].[wct].[POWER] (
   <@x, float,>
  ,<@y, float,>)

Description

Use the scalar function POWER to return the value of the specified expression to the specified power.

Arguments

@x

Is an expression of type float or of a type that can be implicitly converted to float.

@y

Is the power to which to raise @x. @y is an expression of type float or of a type that can be implicitly converted to float.

Return Type

float

Remarks

If POWER evaluates to > 1.79769313486232E+308 then NULL is returned.

If @x < 0 and @y is not an integer then NULL is returned.

Examples

SELECT x,

       y,

       wct.POWER(x, y) as [POWER]

FROM

(

    VALUES

        (2, 0),

        (2, 1023),

        (2, 1024),

        (2, -1075),

        (-2, -1075),

        (-2, 3.5),

        (0, 0)

) n (x, y);

This produces the following result.

{"columns":[{"field":"x","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"y","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"POWER"}],"rows":[{"x":"2","y":"0.0","POWER":"1"},{"x":"2","y":"1023.0","POWER":"8.98846567431158E+307"},{"x":"2","y":"1024.0","POWER":"NULL"},{"x":"2","y":"-1075.0","POWER":"4.94065645841247E-324"},{"x":"-2","y":"-1075.0","POWER":"-4.94065645841247E-324"},{"x":"-2","y":"3.5","POWER":"NULL"},{"x":"0","y":"0.0","POWER":"1"}]}