integerValue

Returns an integer-rounded copy of the receiver as an Arith value.

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

const x = Arith.from("123.456");

x.integerValue().toString(); // "123"
x.integerValue(Arith.ROUND_CEIL).toString(); // "124"

const y = Arith.from("-12.7");
y.integerValue().toString(); // "-13"
y.integerValue(Arith.ROUND_DOWN).toString(); // "-12"

// The receiver is not mutated.
x.toString(); // "123.456"

API Reference

Signature

integerValue(roundingMode?: ArithRoundingMode): ArithInstance;

Parameters

ParameterTypeRequiredNotes
roundingModeArithRoundingModeNoDefaults to current ROUNDING_MODE.

Returns

Returns a new Arith instance rounded to an integer.

Throws

  • Throws if roundingMode is invalid.

Agent Contract

FieldValue
Kindinstance method
Canonical nameintegerValue
AliasesNone
Mutates receiverNo
ReturnsArithInstance
Accepts (string, base) overloadNo
Configuration dependenciesROUNDING_MODE
Related methodsceil, floor, round, trunc

Agent Notes

  • Use toBigInt() only when a bigint | null result is needed; use integerValue() to stay in Arith.
  • 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.