negated

Returns a new Arith with the opposite sign.

Summary

Use this instead of multiplying by -1 when the intent is sign reversal.

AI Contract

FieldValue
Kindinstance method
Canonical namenegated
AliasesNone
Mutates receiverNo
ReturnsArithInstance
Accepts (string, base) overloadNo
Configuration dependenciesNone
Related methodsabsoluteValue

Signature

negated(): ArithInstance;

Parameters

ParameterTypeRequiredNotes
None--This method does not take parameters.

Returns

Returns a new Arith instance.

Behavior

  • Positive values become negative.
  • Negative values become positive.
  • NaN remains NaN.
  • The receiver is not mutated.

Examples

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

new Arith("12.5").negated().toString(); // "-12.5"

Errors

  • Does not take user arguments; no argument validation is performed.

Agent Notes

  • 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