Friday, November 8, 2019

Swift Numerics

Steve Canon (tweet):

I’m excited to announce a new open-source project for the Swift ecosystem, Swift Numerics! Swift Numerics will provide the building blocks of numerical computing in Swift, as a set of fine-grained modules bundled together into a single Swift package. My hope is that we can quickly fill some important gaps in the Standard Library’s existing APIs, and unlock new domains of programming to the Swift language.

I’ve seeded the repository with two much-requested modules that are immediately useful for computational mathematics: Real (providing the functionality of SE-0246) and Complex (providing complex numbers and arithmetic).

[…]

The C and C++ complex math libraries attempt to make fine-grained distinctions between different zeros and infinities and NaNs. This is occasionally useful, but it means that multiplication cannot use the obvious arithmetic expression.

Swift does not attempt to make this distinction. Any complex number with zero real and imaginary parts is zero, and all complex numbers with a non-finite real or imaginary part are collapsed into a single “point at infinity”.

Looks good to me.

Comments RSS · Twitter

Leave a Comment