This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, PR] Crash of Bessel functions at x==0!
- From: FranÃois Dumont <frs dot dumont at gmail dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 09 Feb 2013 21:56:34 +0100
- Subject: Re: [PATCH, PR] Crash of Bessel functions at x==0!
- References: <511320DF.2050400@verizon.net> <511393E1.1090806@oracle.com> <5113BDBD.2000702@verizon.net> <51147A7F.304@verizon.net> <51153F2F.20007@gmail.com> <5115560E.6090405@oracle.com>
Attached patch applied then.
2013-02-09 FranÃois Dumont <fdumont@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