pow

Alias for exponentiatedBy.

Human Summary

Use it as a compact alias when code already makes the exponentiation intent obvious.

AI Contract

FieldValue
Kindinstance method
Canonical nameexponentiatedBy
AliasesexponentiatedBy
Mutates receiverNo
ReturnsArithInstance
Accepts (string, base) overloadNo
Configuration dependenciesDECIMAL_PLACES, ROUNDING_MODE, POW_PRECISION
Related methodsexponentiatedBy, modulo

Signature

pow(n: ArithValue, m?: ArithValue): ArithInstance;
pow(n: number, m?: ArithValue): ArithInstance;

Parameters

ParameterTypeRequiredNotes
n`ArithValuenumber`Yes
mArithValueNoOptional modulus.

Returns

Returns a new Arith instance. The receiver is not modified.

Behavior

  • Same behavior as exponentiatedBy.
  • The exponent must be an integer, except NaN and infinities follow non-finite behavior.
  • Negative exponents are rounded according to DECIMAL_PLACES and ROUNDING_MODE.

Examples

import { Arith } from "@teakit/arith";

new Arith("2").pow(10).toString(); // "1024"

Errors

  • Throws if n is a finite non-integer.
  • Throws if n or m is invalid while STRICT is true.

Agent Notes

  • Prefer exponentiatedBy when clarity matters more than brevity.
  • Import from @teakit/arith; prefer import { Arith } from "@teakit/arith".
  • Use new Arith(...) to construct values. Do not generate Arith(...) as a function call.
  • Use string inputs for exact decimal values, especially money-like values.
  • Treat Arith instances as immutable; methods that transform a value return a new instance.
  • Do not mutate internal fields such as c, e, s, or _isArith.

See Also