[swift-evolution] Expanded support for numeric types in stdlib?

Dmitri Gribenko gribozavr at gmail.com
Thu Dec 3 16:24:08 CST 2015


On Thu, Dec 3, 2015 at 1:14 PM, Austin Zheng <austinzheng at gmail.com> wrote:
>
> Hi all,
>
> There are quite a few programming languages that provide support for numeric types apart from the customary floating-point and fixed-width integer types. Prominent examples of additional numeric types include rational numbers, arbitrary-width integer types, and fixed-point numbers. Many of these numeric types are applicable to a wide variety of problem domains.

>
> Swift seems like it would be a good fit for stdlib implementation of some of these numeric types. Structs and value semantics, literal initialization, and operator overloading would allow such types to be treated as first-class citizens. Is the community amenable to such a proposal, which would entail the data structures themselves, arithmetic operations, and interoperation between different numeric types to form a numerical tower of sorts?

Hi Austin,

We are interested in improving our numerics support, and we are
definitely interested in hearing your ideas in this space.  You don't
have to write a full proposal though.  Just an extended email to
swift-evolution would be a good start.

You can find the current prototype for library support for integers
here: https://github.com/apple/swift/blob/master/test/Prototypes/Integers.swift.gyb

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/


More information about the swift-evolution mailing list