mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 04:50:07 +00:00
5a82c74822
Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
100 lines
3.2 KiB
C
100 lines
3.2 KiB
C
/* Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, see
|
|
<https://www.gnu.org/licenses/>. */
|
|
|
|
/* Test bug #13941. */
|
|
|
|
#include <float.h>
|
|
#include <math.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
static int
|
|
do_test (void)
|
|
{
|
|
#if LDBL_MANT_DIG >= 106
|
|
volatile union { long double l; long long x[2]; } u, v;
|
|
char buf[64];
|
|
#endif
|
|
int result = 0;
|
|
|
|
#if LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 113
|
|
# define COMPARE_LDBL(u, v) \
|
|
((u).l == (v).l && (u).x[0] == (v).x[0] && (u).x[1] == (v).x[1])
|
|
#else
|
|
# define COMPARE_LDBL(u, v) ((u).l == (v).l)
|
|
#endif
|
|
|
|
#define TEST_N(val, n) \
|
|
do \
|
|
{ \
|
|
u.l = (val); \
|
|
snprintf (buf, sizeof buf, "%." #n "LgL", u.l); \
|
|
if (strcmp (buf, #val) != 0) \
|
|
{ \
|
|
printf ("Error on line %d: %s != %s\n", __LINE__, buf, #val); \
|
|
result = 1; \
|
|
} \
|
|
if (sscanf (#val, "%Lg", &v.l) != 1 || !COMPARE_LDBL (u, v)) \
|
|
{ \
|
|
printf ("Error sscanf on line %d: %." #n "Lg != %." #n "Lg\n", \
|
|
__LINE__, u.l, v.l); \
|
|
result = 1; \
|
|
} \
|
|
/* printf ("%s %Lg %016Lx %016Lx\n", #val, u.l, u.x[0], u.x[1]); */ \
|
|
} \
|
|
while (0)
|
|
|
|
#define TEST(val) TEST_N (val,30)
|
|
|
|
#if LDBL_MANT_DIG >= 106
|
|
# if LDBL_MANT_DIG == 106
|
|
TEST (2.22507385850719347803989925739e-308L);
|
|
TEST (2.22507385850719397210554509863e-308L);
|
|
TEST (2.22507385850720088902458687609e-308L);
|
|
|
|
/* Verify precision is not lost for long doubles
|
|
of the form +1.pN,-1.pM. */
|
|
TEST_N (3.32306998946228968225951765070082e+35L, 34);
|
|
# endif
|
|
TEST (2.22507385850720138309023271733e-308L);
|
|
TEST (2.22507385850720187715587855858e-308L);
|
|
TEST (2.2250738585074419930597574044e-308L);
|
|
TEST (4.45014771701440227211481959342e-308L);
|
|
TEST (4.45014771701440276618046543466e-308L);
|
|
TEST (4.45014771701440375431175711716e-308L);
|
|
TEST (4.45014771701440474244304879965e-308L);
|
|
TEST (7.12023634722304600689881138745e-307L);
|
|
TEST (1.13923781555569064960474854133e-305L);
|
|
TEST (1.13777777777777776389998996996L);
|
|
TEST (1.13777777777777765287768750745L);
|
|
TEST (20988295479420645138.2044444444L);
|
|
TEST (20988295479420643090.2044444444L);
|
|
TEST (2.14668699894294423266045294316e-292L);
|
|
# if LDBL_MANT_DIG == 106
|
|
TEST (-2.35993711055432139266626434123e-292L);
|
|
TEST (6.26323524637968345414769634658e-302L);
|
|
TEST (1.49327164802066885331814201989e-308L);
|
|
TEST (3.71834550652787023640837473722e-308L);
|
|
TEST (9.51896449671134907001349268087e-306L);
|
|
# endif
|
|
#endif
|
|
return result;
|
|
}
|
|
|
|
#define TEST_FUNCTION do_test ()
|
|
#include "../test-skeleton.c"
|