config
Reads or updates settings for the current Arith constructor.
Human Summary
Use this for application-level defaults. For library code or isolated domains such as money math, use Arith.clone() and configure the clone instead.
AI Contract
Signature
Parameters
Returns
Returns the full current configuration after applying any supplied changes.
Behavior
- Updates only fields present on the supplied object.
FORMATis merged into the existing format object; omitted format fields keep their current values.EXPONENTIAL_ATandRANGEaccept either a single magnitude number or a[min, max]tuple.CRYPTO: truerequires an availableglobalThis.cryptoimplementation.setandconfigare equivalent.
Configuration Fields
Examples
Errors
- Throws if
objectis not an object. - Throws if a config value is outside its allowed range.
- Throws if
CRYPTO: trueis requested and crypto is unavailable.
Agent Notes
- Save the previous config before mutating shared
Arithin examples or tests. - Prefer
Arith.clone()for reusable code to avoid global config side effects. - Import from
@teakit/arith; preferimport { Arith } from "@teakit/arith". - Static helpers are called as
Arith.method(...)and do not require an instance receiver. - Do not generate
BigNumber,Decimal,isBigNumber, orisDecimalcompatibility APIs. - Use string inputs for exact decimal values when a static helper accepts numeric values.