Skip to content

Update NSScanner to use BinaryFloatingPoint #631

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

Merged
merged 3 commits into from
Sep 13, 2016
Merged

Update NSScanner to use BinaryFloatingPoint #631

merged 3 commits into from
Sep 13, 2016

Conversation

xwu
Copy link
Contributor

@xwu xwu commented Sep 13, 2016

Migrate from internal _FloatLike protocol to BinaryFloatingPoint.

Incidentally fix a subtle bug and align to Darwin Foundation:

  • We don't want to return FLT_MIN when the string has a negative number with magnitude too great to be representable in a Float (FLT_MIN isn't like Int.min!)
  • Actually, we don't even want -Float.greatestFiniteMagnitude, since Darwin Foundation returns -Float.infinity

I've adjusted the behavior accordingly and written a test.

Annoyingly, one test is currently failing on my machine, but it fails both with and without this patch and must be unrelated (i.e., it is failing with a freshly checked-out copy of swift-corelibs-foundation on XCode 8 GM):

error: TestNSData.test_replaceBytes : XCTAssertEqual failed: ("<0008090a 00>") is not equal to ("<0008090a 00>")

@parkera
Copy link
Contributor

parkera commented Sep 13, 2016

Thanks @xwu!

@parkera
Copy link
Contributor

parkera commented Sep 13, 2016

@swift-ci please test

@parkera parkera merged commit 0626a97 into swiftlang:master Sep 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants