Average Error: 4.4 → 2.5
Time: 5.1s
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 -1.604625481357837 \cdot 10^{131} \lor \neg \left(y \le 3.1384890349967341 \cdot 10^{181}\right):\\ \;\;\;\;\left(t \cdot z + x\right) - x \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \left(\left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right) + \left(y \cdot z\right) \cdot \left(-\tanh \left(\frac{x}{y}\right)\right)\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 -1.604625481357837 \cdot 10^{131} \lor \neg \left(y \le 3.1384890349967341 \cdot 10^{181}\right):\\
\;\;\;\;\left(t \cdot z + x\right) - x \cdot z\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r220848 = x;
        double r220849 = y;
        double r220850 = z;
        double r220851 = r220849 * r220850;
        double r220852 = t;
        double r220853 = r220852 / r220849;
        double r220854 = tanh(r220853);
        double r220855 = r220848 / r220849;
        double r220856 = tanh(r220855);
        double r220857 = r220854 - r220856;
        double r220858 = r220851 * r220857;
        double r220859 = r220848 + r220858;
        return r220859;
}

double f(double x, double y, double z, double t) {
        double r220860 = y;
        double r220861 = -1.6046254813578367e+131;
        bool r220862 = r220860 <= r220861;
        double r220863 = 3.138489034996734e+181;
        bool r220864 = r220860 <= r220863;
        double r220865 = !r220864;
        bool r220866 = r220862 || r220865;
        double r220867 = t;
        double r220868 = z;
        double r220869 = r220867 * r220868;
        double r220870 = x;
        double r220871 = r220869 + r220870;
        double r220872 = r220870 * r220868;
        double r220873 = r220871 - r220872;
        double r220874 = r220860 * r220868;
        double r220875 = r220867 / r220860;
        double r220876 = tanh(r220875);
        double r220877 = r220874 * r220876;
        double r220878 = r220870 / r220860;
        double r220879 = tanh(r220878);
        double r220880 = -r220879;
        double r220881 = r220874 * r220880;
        double r220882 = r220877 + r220881;
        double r220883 = r220870 + r220882;
        double r220884 = r220866 ? r220873 : r220883;
        return r220884;
}

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.4
Target2.0
Herbie2.5
\[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 < -1.6046254813578367e+131 or 3.138489034996734e+181 < y

    1. Initial program 16.1

      \[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 sub-neg16.1

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) + \left(-\tanh \left(\frac{x}{y}\right)\right)\right)}\]
    4. Applied distribute-lft-in16.1

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

      \[\leadsto x + \left(\color{blue}{t \cdot z} + \left(y \cdot z\right) \cdot \left(-\tanh \left(\frac{x}{y}\right)\right)\right)\]
    6. Taylor expanded around inf 7.3

      \[\leadsto \color{blue}{\left(t \cdot z + x\right) - x \cdot z}\]

    if -1.6046254813578367e+131 < y < 3.138489034996734e+181

    1. Initial program 1.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 sub-neg1.2

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) + \left(-\tanh \left(\frac{x}{y}\right)\right)\right)}\]
    4. Applied distribute-lft-in1.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.604625481357837 \cdot 10^{131} \lor \neg \left(y \le 3.1384890349967341 \cdot 10^{181}\right):\\ \;\;\;\;\left(t \cdot z + x\right) - x \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \left(\left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right) + \left(y \cdot z\right) \cdot \left(-\tanh \left(\frac{x}{y}\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020035 
(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))))))