Average Error: 4.1 → 1.8
Time: 11.8s
Precision: binary64
\[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 -5.39442978055282742 \cdot 10^{133}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \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 -5.39442978055282742 \cdot 10^{133}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\

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

\end{array}
double code(double x, double y, double z, double t) {
	return ((double) (x + ((double) (((double) (y * z)) * ((double) (((double) tanh(((double) (t / y)))) - ((double) tanh(((double) (x / y))))))))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((y <= -5.394429780552827e+133)) {
		VAR = ((double) (x + ((double) (z * ((double) (t - x))))));
	} else {
		VAR = ((double) (x + ((double) (y * ((double) (z * ((double) (((double) tanh(((double) (t / y)))) - ((double) tanh(((double) (x / y))))))))))));
	}
	return VAR;
}

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.1
Target1.8
Herbie1.8
\[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 < -5.39442978055282742e133

    1. Initial program 14.7

      \[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 flip--25.3

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

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

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

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

    if -5.39442978055282742e133 < y

    1. Initial program 2.6

      \[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*1.1

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

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

Reproduce

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