gt

Returns whether the receiver is greater than another decimal value.

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

0.1 > 0.3 - 0.2; // true

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

// Use the (string, base) overload when the comparison value is written in another base.
Arith.from("11", 3).gt("11.1", 2); // true

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

API Reference

Signature

gt(n: ArithValue): boolean;
gt(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 greater; 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 namegt
AliasesNone
Mutates receiverNo
Returnsboolean
Accepts (string, base) overloadYes
Configuration dependenciesSTRICT
Related methodsge, lt, le, 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.