feat: Start arithmetic functions for complex
All checks were successful
/ test (pull_request) Successful in 17s

So far, adds absquare and add. To get these working, especially on mixed
  types of arguments, this also adds some additional features:
  * Allows conversions to generic types, with the matched type
    determined from the return value of the built convertor
  * Adds predicate-based type patterns
  * Adds conversion from any non-complex type T to Complex(T)
  * Starts tests for complex arithmetic
This commit is contained in:
Glen Whitney 2025-04-24 12:06:47 -07:00
parent 0ff00ff8cb
commit 474cc53d68
9 changed files with 95 additions and 7 deletions

View file

@ -18,7 +18,7 @@ export const equal = match([Any, Any], (math, [T, U]) => {
return boolnum(() => false)(math)
}
// Get the type of the first argument to the matching checker:
const ByType = matched(exactChecker.template).flat()[0]
const ByType = matched(exactChecker.template, math).flat()[0]
// Now see if there are tolerances for that type:
const typeConfig = math.resolve('config', [ByType])
if ('relTol' in typeConfig) {