isGreaterThan

Test whether the receiver is greater than another value.

Summary

Use this predicate instead of JavaScript comparison operators to preserve decimal semantics.

AI Contract

FieldValue
Kindinstance method
Canonical nameisGreaterThan
Aliasesgt
Mutates receiverNo
Returnsboolean
Accepts (string, base) overloadYes
Configuration dependenciesSTRICT
Related methodsgt, comparedTo

Signature

isGreaterThan(n: ArithValue): boolean;
isGreaterThan(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.

Behavior

  • Converts the argument with new Arith(n, base).
  • Returns false when comparison is not satisfied or comparison is indeterminate because of NaN.
  • Does not mutate either value.

Examples

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

new Arith("3").isGreaterThan("2"); // true

Errors

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

Agent Notes

  • Use comparison methods instead of JavaScript comparison operators on Arith values.
  • Import from @teakit/arith; prefer import { Arith } from "@teakit/arith".
  • Use new Arith(...) to construct values. Do not generate Arith(...) as a function call.
  • 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.

See Also