Add floating point parsers - #32
Conversation
cbd8d89 to
dc08d17
Compare
dc08d17 to
1382651
Compare
|
The API documentation is good for now – I'll follow up with DocC curation for these, the LEB parsers, and other APIs we add before the next release. |
| // See https://swift.org/LICENSE.txt for license information | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
There was a problem hiding this comment.
This needs to be #if'd out on macOS/Intel.
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
extension Float16 {
// ...
}
#endif
There was a problem hiding this comment.
We may want to provide a Float(parsingFloat16:) as a workaround for macOS/Intel systems, but that can be a follow-on PR.
| //#else | ||
| //public struct Float80: Sendable, Equatable { | ||
| // init(sign: FloatingPointSign, exponentBitPattern: UInt, significandBitPattern: UInt64) {} | ||
| //} |
There was a problem hiding this comment.
As with Float16, if anything what I would provide here is a fallback bailable parser that tries to parse the Float80 into a Double (what to do for out-of-range values TBD).
|
@natecook1000 Are there plans to merge this? I'm currently maintaining a fork to keep this up to date with main. With some functionality for parsing certain container types on top (Array, InlineArray, SIMD, etc.). I'd love to contribute those if they sound interesting but I'm currently blocked by requiring the floating point parsers. I'd love to push it to the finish line. If anything else is required, please let me know! |
Adds parsers for the standard library floating point types with endianness specifiers. Resolves #25.
Checklist
Scripts/format.shto correctly format my change