feat: config and approximate equality #19

Merged
glen merged 4 commits from config into main 2025-04-16 04:23:49 +00:00

4 commits

Author SHA1 Message Date
92ac7f38ae feat: add the rest of relational from pocomath
All checks were successful
/ test (pull_request) Successful in 18s
2025-04-15 21:04:22 -07:00
c1791ddc20 feat: add nan to types, add hasnan and sign functions
All checks were successful
/ test (pull_request) Successful in 19s
Also makes certain to clean up the dependencies that are being
  generated even in case of throwing an error in the factory for
  a method.
2025-04-15 20:33:13 -07:00
686cd93927 feat: more utility functions
All checks were successful
/ test (pull_request) Successful in 17s
Adds type constants zero and one, and allows you to obtain them
   directly from a type object. This facility creates a behavior
   with a parametric type: the type of `math.zero(T)` where `T` is a
   Type object (i.e., has type `TypeOfTypes`) depends not just on that
   type TypeOfTypes, but instead on the _value_ of the argument `T`. Since
   nanomath is not (yet?) equipped to handle typing such a method, we just
   set its return type to a new constant NotAType that (hopefully) does not
   work with the rest of the type system. Also allows you to compute `zero`
   and `one` from an example value, rather than from the type object itself.

   Adds utility function `isZero` to test if a value is zero.

   As usual so far, the additions uncovered some remaining bugs, which
   this PR fixes. For example, there was a problem in that resolution of
   the `one` method was failing because the `Any` pattern was blocking
   matching of the `TypeOfTypes` pattern. Although we may eventually need to
   sort the patterns for a given method to maintain a reasonable matching
   order, for now the solution was just to move the two patterns into the
   same source file and explicitly order them. (With the way onType and
   Implementations are currently implemented, the proper ordering is more
   general to more specific, i.e. later implementations supersede earlier
   ones.

   Adds many new tests, as always.
2025-04-15 16:23:55 -07:00
d3f2bc09b7 feat: config and approximate equality
All checks were successful
/ test (pull_request) Successful in 17s
Establishes a global config object for a TypeDispatcher instance, so far
  with just properties representing comparison tolerances. Begins a
  "relational" group of functions with basic approximate equality, and
  an initial primitive ordering comparison. Ensures that methods that
  depend on properties of `config` will be properly updated when those
  properties change.
2025-04-15 01:17:27 -07:00