sqrt

Returns the square root of the receiver rounded by the current precision settings.

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

const x = Arith.from("16");
x.sqrt().toString(); // "4"

const y = Arith.from("3");
y.sqrt().toString(); // "1.73205080756887729353"

// Negative finite values return NaN.
Arith.from("-1").sqrt().toString(); // "NaN"

// Use the static helper when no method chain is needed.
Arith.sqrt("81").toString(); // "9"

API Reference

Signature

sqrt(): ArithInstance;

Parameters

ParameterTypeRequiredNotes
None--This method does not take parameters.

Returns

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

Throws

  • Does not take user arguments; no argument validation is performed.

Agent Contract

FieldValue
Kindinstance method and static helper
Canonical namesqrt
AliasesNone
Mutates receiverNo
ReturnsArithInstance
Accepts (string, base) overloadNo
Configuration dependenciesDECIMAL_PLACES, ROUNDING_MODE
Related methodspow

Agent Notes

  • Import with import { Arith } from "@teakit/arith"; default imports are unsupported.
  • Use Arith.from(...) to create values. Do not generate new Arith(...) or Arith(...).
  • 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.