talira

Swift Numerics

Apple's Swift package of numerical computing modules: real and complex math

open sourceApache-2.0 WITH Swift-exceptionfree

Swift Numerics is Apple's package of modules for numerical computing in Swift, holding APIs too specialised for the standard library and APIs being developed toward possible inclusion in it. RealModule adds elementary functions and real-number protocols, ComplexModule adds a Complex type, and IntegerUtilities is on main; each module can be imported on its own, or all of them through the Numerics module. It depends only on the Swift and C standard libraries and compiler-rt, and is source stable under Semantic Versioning.

Problems it solves

  • use complex numbers in Swift
  • call math functions generically over Float and Double in Swift
  • do numerical computing in Swift without pulling in a big framework

Features

  • RealModule: elementary functions and real-number protocols
  • ComplexModule: a Complex number type
  • fine-grained modules or one Numerics import
  • no dependencies beyond the Swift and C standard libraries