Skip to content

Make tgmath tests generic over TGMath protocol, extend to Float80 #15289

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 5 commits into from
Mar 17, 2018

Conversation

stephentyrone
Copy link
Contributor

Define most of the test machinery in terms of a internal TGMath protocol that refines BinaryFloatingPoint. Add a little bit of gyb support to automate adding additional types, as it is likely these tests will need to support Float16 and Float128 in the future. Make all the input values exactly representable in all of the types in question, to avoid representation errors, loosen default tolerance to 3 to make porting to new platforms less noisy.

@stephentyrone stephentyrone requested review from tbkka and xwu March 16, 2018 01:35
Copy link
Collaborator

@xwu xwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

#endif

#if (arch(i386) || arch(x86_64)) && !os(Windows)
typealias TestLiteralType = Float80
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be simply _MaxBuiltinFloatType?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess not =)

@stephentyrone
Copy link
Contributor Author

@swift-ci Please smoke test.

stephentyrone and others added 4 commits March 17, 2018 10:34
…t80.

Define most of the test machinery in terms of a internal TGMath protocol that refines BinaryFloatingPoint. Add a little bit of gyb support to automate adding additional types, as it is likely these tests will need to support Float16 and Float128 in the future. Make all the input values exactly representable in all of the types in question, to avoid representation errors, loosen default tolerance to 3 to make porting to new platforms less noisy.
Merge #if conditions where possible so that they're not all over the file. Get rid of placeholder CGFloat on non-Darwin, which is no longer needed and doesn't work with the new approach anyway.
This reverts commit 714c9ca4bc0269d49d198bfd396118410c8ba178.
@stephentyrone
Copy link
Contributor Author

Rebased so that we make sure this works with the new tgmath implementations before merging.

@stephentyrone
Copy link
Contributor Author

@swift-ci Please smoke test.

@stephentyrone
Copy link
Contributor Author

Sure enough, we should remove the ldexp test, since we've deprecated it and scalbn is the thing now.

@stephentyrone
Copy link
Contributor Author

@swift-ci Please smoke test.

@stephentyrone stephentyrone merged commit ff7dde6 into swiftlang:master Mar 17, 2018
@tbkka
Copy link
Contributor

tbkka commented Mar 19, 2018

This no longer checks that CGFloat implementations match Float on 32-bit and Double on 64-bit. Was that intentional?

@stephentyrone
Copy link
Contributor Author

stephentyrone commented Mar 19, 2018

That’s not what this test is for; ~everything will fail to build if that’s ever violated anyway, so it probably doesn’t need a test, but it’s fairly well covered already.

Edit: ah, I misinterpreted your question. No, I don’t think that’s something we need to enforce. It’s nice-to-have, but not part of the semantics of these operations. I’d be OK with specializing for CGFloat such that it just checks for an exact match with Float/Double, however.

@stephentyrone stephentyrone deleted the generic-tgmath-tests branch March 24, 2018 20:33
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.

3 participants