MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / IntPow

Function IntPow

pkg/sql/sem/tree/eval.go:5353–5365  ·  view source on GitHub ↗

IntPow computes the value of x^y.

(x, y DInt)

Source from the content-addressed store, hash-verified

5351
5352// IntPow computes the value of x^y.
5353func IntPow(x, y DInt) (*DInt, error) {
5354 xd := apd.New(int64(x), 0)
5355 yd := apd.New(int64(y), 0)
5356 _, err := DecimalCtx.Pow(xd, xd, yd)
5357 if err != nil {
5358 return nil, err
5359 }
5360 i, err := xd.Int64()
5361 if err != nil {
5362 return nil, ErrIntOutOfRange
5363 }
5364 return NewDInt(DInt(i)), nil
5365}
5366
5367// PickFromTuple picks the greatest (or least value) from a tuple.
5368func PickFromTuple(ctx *EvalContext, greatest bool, args Datums) (Datum, error) {

Callers 1

eval.goFile · 0.85

Calls 2

NewDIntFunction · 0.85
DIntTypeAlias · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…