Re: [PATCH, PR] Crash of Bessel functions at x==0!

2013-02-09 Thread François Dumont

Attached patch applied then.

2013-02-09  François Dumont  fdum...@gcc.gnu.org

* include/tr1/bessel_function.tcc (__cyl_bessel_ij_series): Code
simplification.


On 02/08/2013 08:46 PM, Paolo Carlini wrote:

On 02/08/2013 07:08 PM, François Dumont wrote:

Just a small remark, in bessel_function.tcc, the following:

+  if (__x == _Tp(0))
+{
+  if (__nu == _Tp(0))
+return _Tp(1);
+  else if (__nu == _Tp(1))
+return _Tp(0);
+  else
+return _Tp(0);
+}

could be simplified into

+  if (__x == _Tp(0))
+return (__nu == _Tp(0)) ? _Tp(1) : _Tp(0);
Thanks Francois. Besides the tiny-winy specific issue, we can all 
learn why normally unrelated changes should not be bundled together in 
the same patch, even more so when the more substantive one is by far 
the smaller.


Anyway, change pre-approved, whoever cares to commit it.

Thanks,
Paolo.



Index: include/tr1/bessel_function.tcc
===
--- include/tr1/bessel_function.tcc	(revision 195919)
+++ include/tr1/bessel_function.tcc	(working copy)
@@ -409,14 +409,8 @@
unsigned int __max_iter)
 {
   if (__x == _Tp(0))
-	{
-  if (__nu == _Tp(0))
-return _Tp(1);
-  else if (__nu == _Tp(1))
-return _Tp(0);
-  else
-return _Tp(0);
-	}
+	return __nu == _Tp(0) ? _Tp(1) : _Tp(0);
+
   const _Tp __x2 = __x / _Tp(2);
   _Tp __fact = __nu * std::log(__x2);
 #if _GLIBCXX_USE_C99_MATH_TR1


Re: [PATCH, PR] Crash of Bessel functions at x==0!

2013-02-08 Thread Ed Smith-Rowland

On 02/08/2013 08:18 AM, Paolo Carlini wrote:

On 02/08/2013 05:09 AM, Ed Smith-Rowland wrote:

Here is a reworked patch...  The asyptotic stuff is removed for now.
Builds and tests cleanon x86_64-unknown-linux.

Please add a:

bool test __attribute__((unused)) = true;

at the beginning of test01. Also , only for consistency, a:

return 0;

in the main.

Ok with these changes.

Thanks!
Paolo.



Committed this...
PR libstdc++/56216

2013-02-08  Edward Smith-Rowland  3dw...@verizon.net

PR libstdc++/56216
* include/tr1/special_function_util.h: Remove spurious const
from numeric arguments.
* include/tr1/riemann_zeta.tcc: Ditto.
* include/tr1/exp_integral.tcc: Ditto.
* include/tr1/bessel_function.tcc: Ditto.
* include/tr1/hypergeometric.tcc: Ditto.
* include/tr1/modified_bessel_func.tcc: Ditto.
* include/tr1/poly_laguerre.tcc: Ditto.
* include/tr1/gamma.tcc: Ditto.
* include/tr1/legendre_function.tcc: Ditto.
* include/tr1/poly_hermite.tcc: Ditto.
* include/tr1/ell_integral.tcc: Ditto.
* include/tr1/bessel_function.tcc (__cyl_bessel_ij_series):
If argument is zero return function value.
* 
testsuite/tr1/5_numerical_facilities/special_functions/08_cyl_bessel_i/pr56216.cc:
New file.
2012-10-26  Edward Smith-Rowland  3dw...@verizon.net

* include/std/system_error (system_error(error_code, const char*),
system_error(int, const error_category, const char*)): New.
* include/std/stdexcept ( logic_error(const char*),
domain_error(const char*), invalid_argument(const char*),
length_error(const char*), out_of_range(const char*),
runtime_error(const char*), range_error(const char*),
overflow_error(const char*), underflow_error(const char*)): New.
* config/abi/pre/gnu.ver: Add symbols for logic_error const char* ctors.