mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-25 06:20:06 +00:00
bb014f50c4
C23 adds various <math.h> function families originally defined in TS 18661-4. Add the logp1 functions (aliases for log1p functions - the name is intended to be more consistent with the new log2p1 and log10p1, where clearly it would have been very confusing to name those functions log21p and log101p). As aliases rather than new functions, the content of this patch is somewhat different from those actually adding new functions. Tests are shared with log1p, so this patch *does* mechanically update all affected libm-test-ulps files to expect the same errors for both functions. The vector versions of log1p on aarch64 and x86_64 are *not* updated to have logp1 aliases (and thus there are no corresponding header, tests, abilist or ulps changes for vector functions either). It would be reasonable for such vector aliases and corresponding changes to other files to be made separately. For now, the log1p tests instead avoid testing logp1 in the vector case (a Makefile change is needed to avoid problems with grep, used in generating the .c files for vector function tests, matching more than one ALL_RM_TEST line in a file testing multiple functions with the same inputs, when it assumes that the .inc file only has a single such line). Tested for x86_64 and x86, and with build-many-glibcs.py.
66 lines
2.0 KiB
C++
66 lines
2.0 KiB
C++
/* Test log1p.
|
|
Copyright (C) 1997-2024 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/>. */
|
|
|
|
#include "libm-test-driver.c"
|
|
|
|
static const struct test_f_f_data log1p_test_data[] =
|
|
{
|
|
TEST_f_f (log1p, -1, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
|
|
TEST_f_f (log1p, -2, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
|
|
TEST_f_f (log1p, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM|XFAIL_ROUNDING_IBM128_LIBGCC),
|
|
TEST_f_f (log1p, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
|
|
|
|
TEST_f_f (log1p, plus_infty, plus_infty, ERRNO_UNCHANGED),
|
|
TEST_f_f (log1p, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
|
TEST_f_f (log1p, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
|
|
TEST_f_f (log1p, snan_value, qnan_value, INVALID_EXCEPTION),
|
|
TEST_f_f (log1p, -snan_value, qnan_value, INVALID_EXCEPTION),
|
|
|
|
AUTO_TESTS_f_f (log1p),
|
|
};
|
|
|
|
static void
|
|
log1p_test (void)
|
|
{
|
|
ALL_RM_TEST (log1p, 0, log1p_test_data, RUN_TEST_LOOP_f_f, END);
|
|
}
|
|
|
|
#if !TEST_MATHVEC
|
|
static void
|
|
logp1_test (void)
|
|
{
|
|
/* logp1 uses the same test data as log1p. */
|
|
ALL_RM_TEST (logp1, 0, log1p_test_data, RUN_TEST_LOOP_f_f, END);
|
|
}
|
|
#endif
|
|
|
|
static void
|
|
do_test (void)
|
|
{
|
|
log1p_test ();
|
|
#if !TEST_MATHVEC
|
|
logp1_test ();
|
|
#endif
|
|
}
|
|
|
|
/*
|
|
* Local Variables:
|
|
* mode:c
|
|
* End:
|
|
*/
|