motoko-base icon indicating copy to clipboard operation
motoko-base copied to clipboard

Possible improvements for `Float.mo` (and `Int.mo`)

Open luc-blaeser opened this issue 2 years ago • 0 comments

Possible areas of improvements for the Float.mo base library:

  • isNaN() function is missing
  • equal() and notEqual() comparisons should consider numerical errors, by requiring an epsilon argument.
  • Positive infinity and negative infinity constants are missing.
  • compare function does not have a total order and is inconsistent, e.g. compare(NaN, NaN) == #greater.
  • neq function has a typo. Rename to neg. The same typo is in Int.mo.

Compiler issues detected while refactoring Float.mo:

  • https://github.com/dfinity/motoko/issues/3646
  • https://github.com/dfinity/motoko/issues/3647

Improvement for Int.mo base library:

  • Fix typo in function name neq.

Update: Resolved in meantime:

  • https://github.com/dfinity/motoko-base/pull/480
  • https://github.com/dfinity/motoko-base/pull/479
  • https://github.com/dfinity/motoko/pull/3676

Currently still open:

  • Positive infinity and negative infinity constants are missing.
  • https://github.com/dfinity/motoko/issues/3647

luc-blaeser avatar Dec 14 '22 14:12 luc-blaeser