On Tue, 30 Apr 2019 at 02:56, Jeff Law <l...@redhat.com> wrote: > > On 1/30/19 7:10 AM, Bárbara de Castro Fernandes wrote: > > This patch simplifies the function tanh (x) * cosh (x) -> sinh (x). > > This rule is derived from the relationship between hyperbolic > > functions. > > > > I ran the tests and gfortran.dg/pr79966.f90 failed, but this failure > > is unrelated to the patch (see > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88711 for more > > information). My architecture is x86_64. > > > > gcc/ChangeLog: > > 2019-01-30 Bárbara Fernandes <barbara.fernan...@usp.br> > > > > * match.pd (tanh (x) * cosh (x)): New simplification rule. > > > > gcc/testsuite/ChangeLog: > > 2019-01-30 Bárbara Fernandes <barbara.fernan...@usp.br> > > > > * tanhtimescosh.c: New test. > So how does this behave for numbers extremely close to zero in practice > and do we have to worry about overflow problems when cosh(x) gets large? Hi Jeff, Just curious, do we want to add math identities like above to match.pd ? In practice, I am not sure how often we'd see "tanh * cosh" instead of sinh directly in source, altho it seems we do simplify tan * cos -> sin. In general, I suppose there are lot of identities we haven't added because the likelihood of "match" part isn't high.
Thanks, Prathamesh > > jeff > > >