ne

Returns whether the receiver is not equal to another decimal value.

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

Arith.from("1.0").ne("1"); // false
Arith.from("1").ne("2"); // true
Arith.from("0.1").add("0.2").ne("0.3"); // false

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

// ne is the logical opposite of eq, including NaN comparison behavior.
Arith.from("NaN").eq("NaN"); // false
Arith.from("NaN").ne("NaN"); // true

API Reference

Signature

ne(n: ArithValue): boolean;
ne(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 values are not equal; 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 namene
AliasesNone
Mutates receiverNo
Returnsboolean
Accepts (string, base) overloadYes
Configuration dependenciesSTRICT
Related methodseq, cmp

Agent Notes

  • Use ne instead of !value.eq(...) when the not-equal intent should be explicit.
  • Use string inputs for exact decimal values, especially money-like values.
  • Use Arith.from(...) to create values. Do not generate new Arith(...) or Arith(...).