lt

Returns whether the receiver is less than another decimal value.

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

0.3 - 0.2 < 0.1; // true

const x = Arith.from("0.3").sub("0.2");
x.lt("0.1"); // false
Arith.from("0").lt(x); // true

// Use the (string, base) overload when the comparison value is written in another base.
Arith.from("9").lt("a", 16); // true

Arith.from("NaN").lt("2"); // false

API Reference

Signature

lt(n: ArithValue): boolean;
lt(n: string, base: number): boolean;

Parameters

ParameterTypeRequiredNotes
nArithValueYesValue to convert to Arith before applying the operation.
basenumberNoOnly valid with the (string, base) overload. Must be an integer from 2 through ALPHABET.length.

Returns

Returns true when the receiver is less; otherwise returns false.

Throws

  • Throws if base is invalid.
  • Throws if the comparison value is invalid while STRICT is true.

Agent Contract

FieldValue
Kindinstance method
Canonical namelt
AliasesNone
Mutates receiverNo
Returnsboolean
Accepts (string, base) overloadYes
Configuration dependenciesSTRICT
Related methodsle, gt, ge, cmp

Agent Notes

  • Use comparison methods instead of JavaScript comparison operators on Arith values.
  • 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.