-
Notifications
You must be signed in to change notification settings - Fork 12
Add floating point parsers #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
Adds parsers for the standard library floating point types with endianness specifiers. Resolves #25.
Checklist
Scripts/format.shto correctly format my change