Public bug reported: On PPC, the non-IEEE 128-bit long double is represented as a pair of doubles. This means that for 1.L, the next representable value in the direction of 2.L should be 1.L + DBL_EPSILON. The nexttowardl function does not seem to produce such a result.
To reproduce, compile and link the following C program and run the resulting executable. The actual output and the expected output is provided below. ### SOURCE (<stdin>): long double nexttowardl(long double, long double); int printf(const char *, ...); int main(void) { long double eps = nexttowardl(0.L, 1.L); long double ans = nexttowardl(1.L, 2.L); long double ref = 1.L + eps; typedef unsigned char *ucp; for (ucp p = (ucp)&ref; p < (ucp)&1[&ref]; ++p) { printf("%02hhx", *p); } printf("\n"); for (ucp p = (ucp)&ans; p < (ucp)&1[&ans]; ++p) { printf("%02hhx", *p); } printf("\n"); } ### COMPILER INVOCATION: gcc -xc - -lm ### RUN OUTPUT: 000000000000f03f0100000000000000 000000000000f03f0000000000006039 ### EXPECTED OUTPUT: 000000000000f03f0100000000000000 000000000000f03f0100000000000000 ### VERSION INFO: > lsb_release -rd Description: Ubuntu 16.04.2 LTS Release: 16.04 Return: 0x00:0 > apt-cache policy libc6 libc6: Installed: 2.23-0ubuntu7 Candidate: 2.23-0ubuntu11 Version table: 2.23-0ubuntu11 500 500 http://ports.ubuntu.com/ubuntu-ports xenial-updates/main ppc64el Packages 2.23-0ubuntu10 500 500 http://ports.ubuntu.com/ubuntu-ports xenial-security/main ppc64el Packages *** 2.23-0ubuntu7 100 100 /var/lib/dpkg/status 2.23-0ubuntu3 500 500 http://ports.ubuntu.com/ubuntu-ports xenial/main ppc64el Packages Return: 0x00:0 ** Affects: glibc (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1831808 Title: nexttowardl for ppc64el generates wrong results To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1831808/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs