mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
b882d4bd6e
Faster FP printing + Float80 **Explanation**: Implements a new, faster debugDescription for floating-point types that uses a modified form of Rafaello Giulietti's Schubfach algorithm. Also expands the Swift-based printing and parsing routines to fully support Float80. **Scope**: The new routines provide exactly the same API and behavior as the previous floating-point printing and parsing. The addition of Float80 parsing support insulates us from OS-specific variations in strtold support. **Risk**: Modest. The code has been well-tested, but there has been a history of 32-bit issues with previous work in this area. **Testing**: Existing unit tests all pass, including tests that verify that we're exporting the same internal endpoints. In addition, correctness has been verified with an offline test suite. Notes: * The core _Float64ToASCII function is about 1/2 the code+data of the previous implementation and also nearly 2x faster than before. This means that Double.debugDescription now spends most of its time allocating memory for the returned String. * The Float80 support for printing and parsing has enough extra precision to also support Float128 if we ever want to add that.
The modules in the 'stdlib/private' directory contain APIs that are considered private to the Swift project. Don't use them outside of the repositories related to the Swift project. These APIs are used for building Swift build and test automation tools, represent early prototypes of APIs that are not intended to be included in the standard library soon, modules to support ports to other platforms, and other similar needs that are private to the Swift project and its development process.