Bruno Haible [Mon, 27 Feb 2012 18:33:31 +0000 (19:33 +0100)]
remainderf-ieee: Work around test failure on OSF/1.
* m4/remainderf-ieee.m4: New file.
* m4/remainderf.m4 (gl_FUNC_REMAINDERF): If gl_FUNC_REMAINDERF_IEEE is
present, test whether remainderf works with a zero second argument.
Replace it if not.
* lib/math.in.h (remainderf): Override if REPLACE_REMAINDERF is 1.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize REPLACE_REMAINDERF.
* modules/math (Makefile.am): Substitute REPLACE_REMAINDERF.
* modules/remainderf (configure.ac): Consider REPLACE_REMAINDERF.
(Depends-on): Update conditions.
* modules/remainderf-ieee (Files): Add m4/remainderf-ieee.m4.
(Depends-on): Add remainder-ieee.
(configure.ac): Invoke gl_FUNC_REMAINDERF_IEEE.
* doc/posix-functions/remainderf.texi: Mention the remainderf-ieee
module.
Bruno Haible [Mon, 27 Feb 2012 17:07:29 +0000 (18:07 +0100)]
remainder-ieee: Work around test failure on OSF/1.
* m4/remainder-ieee.m4: New file.
* m4/remainder.m4 (gl_FUNC_REMAINDER): If gl_FUNC_REMAINDER_IEEE is
present, test whether remainder works with a zero second argument.
Replace it if not.
* lib/math.in.h (remainder): Override if REPLACE_REMAINDER is 1.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize REPLACE_REMAINDER.
* modules/math (Makefile.am): Substitute REPLACE_REMAINDER.
* modules/remainder (configure.ac): Consider REPLACE_REMAINDER.
(Depends-on): Update dependencies.
* modules/remainder-ieee (Files): Add m4/remainder-ieee.m4.
(configure.ac): Invoke gl_FUNC_REMAINDER_IEEE.
* doc/posix-functions/remainder.texi: Mention the remainder-ieee module.
Bruno Haible [Mon, 27 Feb 2012 13:19:01 +0000 (14:19 +0100)]
fmodl-ieee: Work around test failures on OSF/1, MSVC 9.
* m4/fmodl-ieee.m4: New file.
* m4/fmodl.m4 (gl_FUNC_FMODL): If gl_FUNC_FMODL_IEEE is present, test
whether fmodl works with zero arguments. Replace it if not.
* modules/fmodl-ieee (Files): Add m4/fmodl-ieee.m4.
(Depends-on): Add fmod-ieee.
(configure.ac): Invoke gl_FUNC_FMODL_IEEE.
* doc/posix-functions/fmodl.texi: Mention the fmodl-ieee module.
Bruno Haible [Mon, 27 Feb 2012 12:18:57 +0000 (13:18 +0100)]
fmodf-ieee: Work around test failure on OSF/1.
* m4/fmodf-ieee.m4: New file.
* m4/fmodf.m4 (gl_FUNC_FMODF): If gl_FUNC_FMODF_IEEE is present, test
whether fmodf works with zero arguments. Replace it if not.
* lib/math.in.h (fmodf): Override if REPLACE_FMODF is 1.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize REPLACE_FMODF.
* modules/math (Makefile.am): Substitute REPLACE_FMODF.
* modules/fmodf (configure.ac): Consider REPLACE_FMODF.
(Depends-on): Update dependencies.
* modules/fmodf-ieee (Files): Add m4/fmodf-ieee.m4.
(configure.ac): Invoke gl_FUNC_FMODF_IEEE.
* doc/posix-functions/fmodf.texi: Mention the problem on OSF/1.
Bruno Haible [Mon, 27 Feb 2012 11:28:29 +0000 (12:28 +0100)]
fmod-ieee: Work around test failures on OSF/1, mingw.
* m4/fmod-ieee.m4: New file.
* m4/fmod.m4 (gl_FUNC_FMOD): If gl_FUNC_FMOD_IEEE is present, test
whether fmod works with zero arguments. Replace it if not.
* lib/math.in.h (fmod): New declaration.
* lib/fmod.c: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether fmod is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_FMOD, REPLACE_FMOD.
* modules/math (Makefile.am): Substitute GNULIB_FMOD, REPLACE_FMOD.
* modules/fmod (Files): Add lib/fmod.c.
(Depends-on): Add math, isinf, trunc, fma.
(configure.ac): Arrange to compile lib/fmod.c if needed.
* modules/fmod-ieee (Files): Add m4/fmod-ieee.m4, m4/minus-zero.m4,
m4/signbit.m4.
(configure.ac): Invoke gl_FUNC_FMOD_IEEE.
* tests/test-math-c++.cc: Check the declaration of fmod.
* doc/posix-functions/fmod.texi: Mention the fmod-ieee module.
Paul Eggert [Mon, 27 Feb 2012 07:09:05 +0000 (23:09 -0800)]
regex: re_search etc. should return -2 when memory exhausted
This bug was uncovered when testing 'grep'. Without the fix,
re_search and friends return -1 when memory is exhausted, but -1
means no match, and this causes grep to falsely report no-match
instead of memory-exhaustion. See
<http://sources.redhat.com/bugzilla/show_bug.cgi?id=13762>.
* lib/regexec.c (re_search_stub): Return -2 (not -1) if there is
trouble; this can occur if re_search_internal ran out of memory.
Bruno Haible [Mon, 27 Feb 2012 00:44:57 +0000 (01:44 +0100)]
modf-ieee: Work around test failures on *BSD, IRIX, OSF/1, Cygwin.
* m4/modf-ieee.m4: New file.
* m4/modf.m4 (gl_FUNC_MODF): If gl_FUNC_MODF_IEEE is present, test
whether modf works with NaN and Inf. Replace it if not.
* lib/math.in.h (modf): New declaration.
* lib/modf.c: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether modf is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_MODF, REPLACE_MODF.
* modules/math (Makefile.am): Substitute GNULIB_MODF, REPLACE_MODF.
* modules/modf (Files): Add lib/modf.c.
(Depends-on): Add math, isfinite, trunc, isinf.
(configure.ac): Addrange to compile lib/modf.c if needed.
* modules/modf-ieee (Files): Add m4/modf-ieee.m4, m4/minus-zero.m4,
m4/signbit.m4.
(configure.ac): Invoke gl_FUNC_MODF_IEEE.
* tests/test-math-c++.cc: Check the declaration of modf.
* doc/posix-functions/modf.texi: Mention the modf-ieee module.
Bruno Haible [Sat, 25 Feb 2012 23:36:01 +0000 (00:36 +0100)]
fmodl, remainder*: Avoid wrong results due to rounding errors.
* lib/fmodl.c (fmodl): Correct the result if it is not within the
expected bounds.
* lib/remainderf.c (remainderf): Likewise.
* lib/remainder.c (remainder): Likewise.
* lib/remainderl.c (remainderl): Likewise.
Bruno Haible [Sat, 25 Feb 2012 12:13:59 +0000 (13:13 +0100)]
fabs tests: More tests.
* tests/test-fabs.c: Include <string.h>, minus-zero.h.
(zero): New variable.
(main): Add tests for signed zero.
* modules/fabs-tests (Files): Add tests/minus-zero.h.
Bruno Haible [Sat, 25 Feb 2012 12:13:10 +0000 (13:13 +0100)]
fabsf tests: More tests.
* tests/test-fabsf.c: Include <string.h>, minus-zero.h.
(zero): New variable.
(main): Add tests for signed zero.
* modules/fabsf-tests (Files): Add tests/minus-zero.h.
Bruno Haible [Sat, 25 Feb 2012 00:45:18 +0000 (01:45 +0100)]
atanl: Provide function definition on MSVC.
* m4/atanl.m4 (gl_FUNC_ATANL): Test also whether atanl can be used as a
function pointer.
* lib/math.in.h (atanl): Undefine if it does not exist as a function.
Bruno Haible [Sat, 25 Feb 2012 00:42:45 +0000 (01:42 +0100)]
acosl: Provide function definition on MSVC.
* m4/acosl.m4 (gl_FUNC_ACOSL): Test also whether acosl can be used as a
function pointer.
* lib/math.in.h (acosl): Undefine if it does not exist as a function.
Bruno Haible [Sat, 25 Feb 2012 00:39:34 +0000 (01:39 +0100)]
asinl: Provide function definition on MSVC.
* m4/asinl.m4 (gl_FUNC_ASINL): Test also whether asinl can be used as a
function pointer.
* lib/math.in.h (asinl): Undefine if it does not exist as a function.
Bruno Haible [Sat, 25 Feb 2012 00:36:41 +0000 (01:36 +0100)]
tanl: Provide function definition on MSVC.
* m4/tanl.m4 (gl_FUNC_TANL): Test also whether tanl can be used as a
function pointer.
* lib/math.in.h (tanl): Undefine if it does not exist as a function.