Hi all --
A few people have reached out about the Decimal64 GSoC project, so I thought I would write up one set of notes and have a single thread to answer any questions.
This project is about implementing arithmetic and basic operations in the IEEE 754 Decimal 64 format (decimal64 floating-point format - Wikipedia). This is distinct from Foundation.Decimal provided by Foundation, and from "big decimal" arbitrary-precision formats provided in some languages. The Wikipedia page (and links from there) is a good resource to familiarize yourself with the basics. The formal reference is the IEEE 754 standard, but that document costs money, so I would not expect you to have a copy while writing a proposal. I will arrange for you to have access if your proposal is funded.
Decimal64 will be delivered in a new module within Swift Numerics; following a period of some polish, I would expect it to be merged into the standard library at some future point (this will require a Swift Evolution proposal, which you might choose to do or help with, but that is outside the scope of this GSoC project).
There are a few implementations of Decimal64 in other languages. The most widely used open-source implementation that I know of is Intel's (misc/intel), written in C and BSD-licensed. It is useful as a reference (especially for testing purposes), but we will probably make some different choices in the course of our own implementation.
The Decimal64 type should end up conforming to the following protocols:
- FloatingPoint (Apple Developer Documentation).
- A new DecimalFloatingPoint protocol mirroring BinaryFloatingPoint (Apple Developer Documentation).
Essentially all of the API surface of the type flows from these two protocols (and the protocols they refine), so there is little or no API design to be done as part of this project*, and the semantics of these operations are almost fully specified by the IEEE 754 bindings, so this is in some sense "pure" implementation--there is a nearly complete specification, all that is to be done is to make it work.
(*) A follow-on / stretch task would be to define new API that handles rounding control, which Swift doesn't currently model for binary floating-point.