toObject
Returns the coefficient, exponent, and sign fields as a plain object.
Summary
Use it for low-level inspection or debugging when string output is not enough.
AI Contract
Signature
Parameters
Returns
Returns { c, e, s } with coefficient array copied when present.
Behavior
- Finite values have a coefficient array
c, exponente, and signs. - Non-finite values have
c: nullande: null. - The returned coefficient array is a copy.
- The returned object is not tagged with
_isArith: true, so do not treatnew Arith(x.toObject())as the normal reconstruction path.
Examples
Errors
- Does not take user arguments; no argument validation is performed.
Agent Notes
- Prefer public methods over internal object fields for ordinary arithmetic.
- Prefer
toString()for portable serialization; usetoObject()only when low-level internals are required. - Import from
@teakit/arith; preferimport { Arith } from "@teakit/arith". - Use
new Arith(...)to construct values. Do not generateArith(...)as a function call. - Use string inputs for exact decimal values, especially money-like values.
- Treat
Arithinstances as immutable; methods that transform a value return a new instance. - Do not mutate internal fields such as
c,e,s, or_isArith.