Average Error: 4.5 → 3.4
Time: 1.1m
Precision: 64
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
\[\begin{array}{l} \mathbf{if}\;y \le 3.756259882225389882314932700969424341805 \cdot 10^{164}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \left(\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}\right) \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(t \cdot z - x \cdot z\right)\\ \end{array}\]
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\begin{array}{l}
\mathbf{if}\;y \le 3.756259882225389882314932700969424341805 \cdot 10^{164}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \left(\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}\right) \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x + \left(t \cdot z - x \cdot z\right)\\

\end{array}
double f(double x, double y, double z, double t) {
        double r604878 = x;
        double r604879 = y;
        double r604880 = z;
        double r604881 = r604879 * r604880;
        double r604882 = t;
        double r604883 = r604882 / r604879;
        double r604884 = tanh(r604883);
        double r604885 = r604878 / r604879;
        double r604886 = tanh(r604885);
        double r604887 = r604884 - r604886;
        double r604888 = r604881 * r604887;
        double r604889 = r604878 + r604888;
        return r604889;
}

double f(double x, double y, double z, double t) {
        double r604890 = y;
        double r604891 = 3.75625988222539e+164;
        bool r604892 = r604890 <= r604891;
        double r604893 = x;
        double r604894 = z;
        double r604895 = r604890 * r604894;
        double r604896 = t;
        double r604897 = r604896 / r604890;
        double r604898 = tanh(r604897);
        double r604899 = cbrt(r604898);
        double r604900 = r604899 * r604899;
        double r604901 = r604900 * r604899;
        double r604902 = r604893 / r604890;
        double r604903 = tanh(r604902);
        double r604904 = r604901 - r604903;
        double r604905 = r604895 * r604904;
        double r604906 = r604893 + r604905;
        double r604907 = r604896 * r604894;
        double r604908 = r604893 * r604894;
        double r604909 = r604907 - r604908;
        double r604910 = r604893 + r604909;
        double r604911 = r604892 ? r604906 : r604910;
        return r604911;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original4.5
Target1.9
Herbie3.4
\[x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\]

Derivation

  1. Split input into 2 regimes
  2. if y < 3.75625988222539e+164

    1. Initial program 3.0

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
    2. Using strategy rm
    3. Applied add-cube-cbrt3.1

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\color{blue}{\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}\right) \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}} - \tanh \left(\frac{x}{y}\right)\right)\]

    if 3.75625988222539e+164 < y

    1. Initial program 18.2

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
    2. Using strategy rm
    3. Applied associate-*l*8.9

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)}\]
    4. Using strategy rm
    5. Applied flip3--35.7

      \[\leadsto x + y \cdot \left(z \cdot \color{blue}{\frac{{\left(\tanh \left(\frac{t}{y}\right)\right)}^{3} - {\left(\tanh \left(\frac{x}{y}\right)\right)}^{3}}{\tanh \left(\frac{t}{y}\right) \cdot \tanh \left(\frac{t}{y}\right) + \left(\tanh \left(\frac{x}{y}\right) \cdot \tanh \left(\frac{x}{y}\right) + \tanh \left(\frac{t}{y}\right) \cdot \tanh \left(\frac{x}{y}\right)\right)}}\right)\]
    6. Applied associate-*r/36.3

      \[\leadsto x + y \cdot \color{blue}{\frac{z \cdot \left({\left(\tanh \left(\frac{t}{y}\right)\right)}^{3} - {\left(\tanh \left(\frac{x}{y}\right)\right)}^{3}\right)}{\tanh \left(\frac{t}{y}\right) \cdot \tanh \left(\frac{t}{y}\right) + \left(\tanh \left(\frac{x}{y}\right) \cdot \tanh \left(\frac{x}{y}\right) + \tanh \left(\frac{t}{y}\right) \cdot \tanh \left(\frac{x}{y}\right)\right)}}\]
    7. Applied associate-*r/36.3

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(z \cdot \left({\left(\tanh \left(\frac{t}{y}\right)\right)}^{3} - {\left(\tanh \left(\frac{x}{y}\right)\right)}^{3}\right)\right)}{\tanh \left(\frac{t}{y}\right) \cdot \tanh \left(\frac{t}{y}\right) + \left(\tanh \left(\frac{x}{y}\right) \cdot \tanh \left(\frac{x}{y}\right) + \tanh \left(\frac{t}{y}\right) \cdot \tanh \left(\frac{x}{y}\right)\right)}}\]
    8. Taylor expanded around 0 6.4

      \[\leadsto x + \color{blue}{\left(t \cdot z - x \cdot z\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 3.756259882225389882314932700969424341805 \cdot 10^{164}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \left(\left(\sqrt[3]{\tanh \left(\frac{t}{y}\right)} \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)}\right) \cdot \sqrt[3]{\tanh \left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(t \cdot z - x \cdot z\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019353 
(FPCore (x y z t)
  :name "SynthBasics:moogVCF from YampaSynth-0.2"
  :precision binary64

  :herbie-target
  (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y))))))

  (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))