shiftedBy

Returns the receiver multiplied by 10 raised to the supplied integer power.

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

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

x.shiftedBy(3).toString(); // "1230"
x.shiftedBy(-3).toString(); // "0.00123"

// shiftedBy moves the decimal point by powers of ten.
Arith.from("12345").shiftedBy(-2).toString(); // "123.45"
Arith.from("0.001").shiftedBy(6).toString(); // "1000"

API Reference

Signature

shiftedBy(n: number): ArithInstance;

Parameters

ParameterTypeRequiredNotes
nnumberYesInteger shift count. Positive shifts right; negative shifts left.

Returns

Returns a new Arith instance.

Throws

  • Throws if n is not an integer in the safe supported range.

Agent Contract

FieldValue
Kindinstance method
Canonical nameshiftedBy
AliasesNone
Mutates receiverNo
ReturnsArithInstance
Accepts (string, base) overloadNo
Configuration dependenciesNone
Related methodsmul

Agent Notes

  • Prefer shiftedBy over manual string decimal-point manipulation.
  • 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.