Skip to content
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

Add tests for logs of subnormals #39550

Merged
merged 2 commits into from
Feb 7, 2021
Merged

Add tests for logs of subnormals #39550

merged 2 commits into from
Feb 7, 2021

Conversation

kshyatt
Copy link
Contributor

@kshyatt kshyatt commented Feb 6, 2021

These branches for log weren't tested. Checked the results against WA.

@kshyatt kshyatt added test This change adds or pertains to unit tests maths Mathematical functions labels Feb 6, 2021
@kshyatt
Copy link
Contributor Author

kshyatt commented Feb 6, 2021

Test failure is a timeout

@oscardssmith
Copy link
Member

This is a good test in theory, but I have a few issues with it in practice. The first is that the default rtol for is sqrt(eps(T)) which is much bigger than the 2eps(T) we probably want for scalar functions. The second issue is that since this only tests a single value, it is reasonably likely that a mostly good log implementation will get this value correct by chance. A more thorough test would be to take 1000 equally spaced subnormals, and perform a test like isapprox(T(log(widen(x))), log(x), rtol=2*eps(x)

@kshyatt
Copy link
Contributor Author

kshyatt commented Feb 6, 2021

That's a good point, I'll add a more thorough test of various values and tighten the bounds

@oscardssmith
Copy link
Member

Also while I'm making suggestions, any chance you could add log2 and log10 tests here? It will be nice (especially since #39556 will hopefully be changing the implementation of log2 and log10)

@kshyatt
Copy link
Contributor Author

kshyatt commented Feb 7, 2021

Alright, done! Look good to you, @oscardssmith ?

Copy link
Member

@oscardssmith oscardssmith left a comment

Choose a reason for hiding this comment

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

Approved assuming tests pass.

@oscardssmith oscardssmith merged commit c99a552 into master Feb 7, 2021
@oscardssmith oscardssmith deleted the ksh/subnormallog branch February 7, 2021 20:09
@oscardssmith oscardssmith restored the ksh/subnormallog branch February 7, 2021 20:10
@martinholters martinholters deleted the ksh/subnormallog branch February 7, 2021 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maths Mathematical functions test This change adds or pertains to unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants