luna-complex
Luna-Flow/luna-complex provides complex numbers for Luna Flow. The root
package defines the generic type Complex[T], the ring
over any scalar T, with its arithmetic and luna-generic structure
instances. The float_backend package adds the analytic functions of
Complex[Double] (roots, logarithms, powers, trigonometric and hyperbolic
functions and their inverses) with numerically stable formulas, and the
capability traits for floating-point scalars.
This manual documents the code of version 0.2.0 (the version in
moon.mod) on MoonBit 0.10.
Packages
| Package | Import path | Role | Pages |
|---|---|---|---|
core | Luna-Flow/luna-complex | generic Complex[T]: construction, mutation, arithmetic, conjugation, structure instances | API · tutorial · design |
float_backend | Luna-Flow/luna-complex/float_backend | analytic functions of Complex[Double]; FloatingAnalyticScalar, FloatingSpecialValues, FloatingBackendScalar | API · tutorial · design |
The root package is documented under the name core. float_backend
replaces the former double_ext package.
Reading paths
First steps. Read the core tutorial for arithmetic,
then the float_backend tutorial for sqrt,
log, sin and the other functions.
Using the library. Keep the core API and the float_backend API at hand; the latter states the branch, special-value and abort behaviour of every function, including the known deviations on the negative real axis.
Contributing. Read the core design for the algebra and the lawfulness of the instances, the float_backend design for the derivations of the stable formulas and the branch cuts, and the contribution guide.
Installation
moon add Luna-Flow/luna-complex@0.2.0
import {
"Luna-Flow/luna-complex" @complex,
"Luna-Flow/luna-complex/float_backend" @fb,
}
Toolchain
MoonBit moonc 0.10 or newer with moon.mod / moon.pkg manifests. The
tests run on wasm-gc, wasm, js and native.
Validation
moon check --target all
moon test
moon info