The Number value model ready
A Number is a real-or-complex value, the Go analogue of Ruby’s Float-or-Complex โ Real(x) and Complex(re, im) build arguments, and Complex(re, 0) stays complex exactly as Complex(1, 0).real? is false in Ruby.
Real-vs-complex branch ready
Each function returns a real result on the real branch (Sqrt(Real(4)) is 2.0) and a complex result otherwise (Sqrt(Real(-4)) is (0+2i)), reproducing CMath’s exact real-vs-complex decision.
Roots, exp & log ready
Sqrt, Cbrt, Exp, Log (with optional base), Log2, Log10 โ mirroring CMath.sqrt / cbrt / exp / log / log2 / log10, on MRI’s principal branch cuts.
Trig & hyperbolic ready
Sin / Cos / Tan, Sinh / Cosh / Tanh, and the inverses Asin / Acos / Atan / Atan2 / Asinh / Acosh / Atanh โ the inverses built from this package’s own Log and Sqrt, exactly as the cmath gem builds them.
MRI branch cuts ready
Outside the real branch, each function uses the same closed-form expression CMath’s Ruby source uses, so the principal branch cuts and float results agree with ruby -rcmath to floating-point rounding.
MRI oracle & coverage ready
Golden values captured from MRI 4.0.5 hold coverage at 100%; an oracle suite drives ruby -rcmath across a broad real / negative / out-of-domain / complex corpus. Green across all six 64-bit Go arches and three OSes, cgo disabled.