This is an archive of the discontinued LLVM Phabricator instance.

[libcxx][tests]Skip checking midpoint of adjacent values for PPC double-double
ClosedPublic

Authored by xingxue on May 24 2019, 6:09 AM.

Details

Summary

For 128 bit long double implemented as 2 doubles on PowerPC, nextafterl() of libm gives imprecise results which fails the test that checks the midpoint of adjacent values. This patch skips the test for this particular case on PowerPC.

Diff Detail

Repository
rCXX libc++

Event Timeline

xingxue created this revision.May 24 2019, 6:09 AM

Seems reasonable. @mclow.lists, any comments?

I'd like to understand what's going on with nextafter when you say "is unreliable". Is there a link describing this behavior?

libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp
91

This is all compile-time stuff; we shouldn't be doing a runtime check.
Also, in other places we check #if defined(__PPC__) not just #if __PPC__

114

We don't usually write outputs in tests; no one looks at them.

In svn 360673 we changed this call from "nextoward` to nextafter because NetBSD 8 doesn't implement the former.

I'd like to understand what's going on with nextafter when you say "is unreliable". Is there a link describing this behavior?

https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1831808

xingxue updated this revision to Diff 203372.Jun 6 2019, 8:29 AM

Addressed comments:

  • Skip the test of midpoint of adjacent values for PPC double-double based on compile-time checking;
  • Use #if defined(__PPC__) instead of #if __PPC__ ;
  • Removed output to std::cerr.
xingxue marked 4 inline comments as done.EditedJun 6 2019, 8:40 AM

Thanks Marshall and Hubert for your comments!

libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp
91

Changed to skip the test without a runtime check. Use #if defined(__PPC__) as suggested.

114

Removed the output.

xingxue marked 2 inline comments as done.Jun 11 2019, 6:37 AM

Hi @mclow.lists, Do you have any further comments?

mclow.lists accepted this revision.Jun 18 2019, 2:17 PM

I was updating this test this morning to add constexpr tests, so I just committed this as revision 363740.

This revision is now accepted and ready to land.Jun 18 2019, 2:17 PM

I believe that all comments have been addressed. LGTM.

libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp
84

Just a note: It appears AIX does not provide nextafterl for such long doubles anyway.

xingxue closed this revision.Jun 19 2019, 6:45 AM

Thanks to Marshall for committing the patch. Closing this revision.

llvm-svn: 363740