feat: Fully define complex cube root (#39)
All checks were successful
/ test (push) Successful in 17s

Also extends add and multiply to allow multiple arguments.

Resolves #29.

Reviewed-on: #39
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Co-committed-by: Glen Whitney <glen@studioinfinity.org>
This commit is contained in:
Glen Whitney 2025-12-13 07:34:01 +00:00 committed by Glen Whitney
parent fbbc2502bd
commit 8d3e6e70cb
10 changed files with 195 additions and 21 deletions

View file

@ -1,4 +1,5 @@
import {ReturnsAs} from './helpers.js'
import {iterateBinary, ReturnsAs} from './helpers.js'
import {plain} from "#number/helpers.js"
import {Returns, ReturnType, ReturnTyping} from '#core/Type.js'
import {match, Any} from '#core/TypePatterns.js'
@ -18,3 +19,9 @@ export const square = match(Any, (math, T, strategy) => {
const mult = math.multiply.resolve([T, T], strategy)
return ReturnsAs(mult, t => mult(t, t))
})
export const add = iterateBinary('add')
add.push(plain(() => 0))
export const multiply = iterateBinary('multiply')
multiply.push(plain(() => 1))