integerValue

Returns a rounded integer copy of the receiver.

Human Summary

Use this when the result should remain an Arith value instead of a JavaScript integer.

AI Contract

FieldValue
Kindinstance method
Canonical nameintegerValue
AliasesNone
Mutates receiverNo
ReturnsArithInstance
Accepts (string, base) overloadNo
Configuration dependenciesROUNDING_MODE
Related methodsdecimalPlaces, precision

Signature

integerValue(roundingMode?: ArithRoundingMode): ArithInstance;

Parameters

ParameterTypeRequiredNotes
roundingModeArithRoundingModeNoDefaults to current ROUNDING_MODE.

Returns

Returns a new Arith instance rounded to an integer.

Behavior

  • Rounds at the decimal point using the supplied rounding mode.
  • If no mode is supplied, uses current ROUNDING_MODE.
  • The receiver is not modified.

Examples

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

new Arith("1.8").integerValue(Arith.ROUND_FLOOR).toString(); // "1"
new Arith("1.8").integerValue(Arith.ROUND_CEIL).toString(); // "2"

Errors

  • Throws if roundingMode is invalid.

Agent Notes

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