Skip to content

arithmetic operator functions are missing #1

@JohnAD

Description

@JohnAD
  • == Equality. Specifically, an equality check that ignores significant digits. For equality checks that take significance into account, there is already the === operator.
  • != Not Equality.
  • + Addition.
  • - Subtraction.
  • * Multiplication.
  • / Division.
  • div Integer Division.
  • mod Modulo.
  • < Less-than.
  • <= Less-than-or-equal.
  • > Greater-than.
  • >= Greater-than-or-equal.

While encoding/decoding and simple import/export from native data types is supported, the basic ability to do math with the library is missing.

These functions cannot resort to simply converting to either float64 or int64 since those types lack both the precision and the needed scale for the math to properly work.

I've started a document that explains, in the context of this library, how significance and rounding should be handled. See https://github.com/JohnAD/decimal128/blob/master/explaining-op-significance.rst I'm not a mathematician and all coments are welcome regarding it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions