ge

Returns whether the receiver is greater than or equal to another decimal value.

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

0.3 - 0.2 >= 0.1; // false

const x = Arith.from("0.3").sub("0.2");
x.ge("0.1"); // true
Arith.from("1").ge(x); // true
Arith.from("2").ge("3"); // false

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

API Reference

Signature

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

Parameters

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

Returns

Returns true when the receiver is greater than or equal to the comparison value; 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 namege
AliasesNone
Mutates receiverNo
Returnsboolean
Accepts (string, base) overloadYes
Configuration dependenciesSTRICT
Related methodsgt, lt, le, cmp

Agent Notes

  • Use ge instead of JavaScript >= on Arith values.
  • Use gt for strict greater-than checks.
  • Use string inputs for exact decimal values, especially money-like values.