http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51133
Bug #: 51133 Summary: Incorrect implementation of std::tr1::hermite() Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: dick...@gmail.com Created attachment 25820 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25820 Patch fixing error in poly_hermite.tcc recursion relation The hermite() function in std::tr1, defined in libstdc++-v3/include/tr1/poly_hermite.tcc uses a recursion relation which has a sign error. The following line: __H_n = 2 * (__x * __H_nm1 + (__i - 1) * __H_nm2); should be changed to: __H_n = 2 * (__x * __H_nm1 - (__i - 1) * __H_nm2); I have attached a patch (generated inside poly_hermite.tcc's folder) which makes this change. This patch has been tested with gcc 4.6.1 by checking via numerical integration that the resultant polynomial has the correct orthogonality. As implemented, the result of this numerical integration was extremely accurate to at least 14 decimal places at up to n=84 for double precision.