?

Average Error: 4.4 → 0.8
Time: 49.8s
Precision: binary64
Cost: 27332

?

\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
\[\begin{array}{l} t_1 := \tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\\ \mathbf{if}\;x + \left(y \cdot z\right) \cdot t_1 \leq \infty:\\ \;\;\;\;x + z \cdot \left(y \cdot t_1\right)\\ \mathbf{else}:\\ \;\;\;\;x + 2 \cdot \frac{z}{\frac{2}{t - x}}\\ \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (tanh (/ t y)) (tanh (/ x y)))))
   (if (<= (+ x (* (* y z) t_1)) INFINITY)
     (+ x (* z (* y t_1)))
     (+ x (* 2.0 (/ z (/ 2.0 (- t x))))))))
double code(double x, double y, double z, double t) {
	return x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
}
double code(double x, double y, double z, double t) {
	double t_1 = tanh((t / y)) - tanh((x / y));
	double tmp;
	if ((x + ((y * z) * t_1)) <= ((double) INFINITY)) {
		tmp = x + (z * (y * t_1));
	} else {
		tmp = x + (2.0 * (z / (2.0 / (t - x))));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	return x + ((y * z) * (Math.tanh((t / y)) - Math.tanh((x / y))));
}
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.tanh((t / y)) - Math.tanh((x / y));
	double tmp;
	if ((x + ((y * z) * t_1)) <= Double.POSITIVE_INFINITY) {
		tmp = x + (z * (y * t_1));
	} else {
		tmp = x + (2.0 * (z / (2.0 / (t - x))));
	}
	return tmp;
}
def code(x, y, z, t):
	return x + ((y * z) * (math.tanh((t / y)) - math.tanh((x / y))))
def code(x, y, z, t):
	t_1 = math.tanh((t / y)) - math.tanh((x / y))
	tmp = 0
	if (x + ((y * z) * t_1)) <= math.inf:
		tmp = x + (z * (y * t_1))
	else:
		tmp = x + (2.0 * (z / (2.0 / (t - x))))
	return tmp
function code(x, y, z, t)
	return Float64(x + Float64(Float64(y * z) * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))))
end
function code(x, y, z, t)
	t_1 = Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))
	tmp = 0.0
	if (Float64(x + Float64(Float64(y * z) * t_1)) <= Inf)
		tmp = Float64(x + Float64(z * Float64(y * t_1)));
	else
		tmp = Float64(x + Float64(2.0 * Float64(z / Float64(2.0 / Float64(t - x)))));
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
end
function tmp_2 = code(x, y, z, t)
	t_1 = tanh((t / y)) - tanh((x / y));
	tmp = 0.0;
	if ((x + ((y * z) * t_1)) <= Inf)
		tmp = x + (z * (y * t_1));
	else
		tmp = x + (2.0 * (z / (2.0 / (t - x))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * z), $MachinePrecision] * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x + N[(N[(y * z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], Infinity], N[(x + N[(z * N[(y * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(2.0 * N[(z / N[(2.0 / N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\\
\mathbf{if}\;x + \left(y \cdot z\right) \cdot t_1 \leq \infty:\\
\;\;\;\;x + z \cdot \left(y \cdot t_1\right)\\

\mathbf{else}:\\
\;\;\;\;x + 2 \cdot \frac{z}{\frac{2}{t - x}}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original4.4
Target2.0
Herbie0.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 (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < +inf.0

    1. Initial program 3.4

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Simplified0.6

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

      [Start]3.4

      \[ x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]

      rational.json-simplify-2 [=>]3.4

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

      rational.json-simplify-2 [=>]3.4

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

      rational.json-simplify-43 [=>]0.6

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

    if +inf.0 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

    1. Initial program 64.0

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Simplified52.4

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

      [Start]64.0

      \[ x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]

      rational.json-simplify-2 [=>]64.0

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

      rational.json-simplify-43 [=>]52.4

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

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

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

      [Start]17.1

      \[ x + y \cdot \frac{\left(t - x\right) \cdot z}{y} \]

      rational.json-simplify-2 [<=]17.1

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

      rational.json-simplify-49 [=>]17.3

      \[ x + y \cdot \color{blue}{\left(\left(t - x\right) \cdot \frac{z}{y}\right)} \]
    5. Applied egg-rr17.3

      \[\leadsto x + y \cdot \color{blue}{\frac{t - x}{\frac{y}{z}}} \]
    6. Applied egg-rr18.3

      \[\leadsto x + \color{blue}{\frac{y}{\frac{y}{\left(t - x\right) \cdot z}}} \]
    7. Applied egg-rr10.2

      \[\leadsto x + \color{blue}{2 \cdot \frac{z}{\frac{2}{t - x}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \leq \infty:\\ \;\;\;\;x + z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + 2 \cdot \frac{z}{\frac{2}{t - x}}\\ \end{array} \]

Alternatives

Alternative 1
Error1.7
Cost13764
\[\begin{array}{l} \mathbf{if}\;y \leq 2.25 \cdot 10^{+185}:\\ \;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(t - x\right) \cdot z\\ \end{array} \]
Alternative 2
Error12.4
Cost7628
\[\begin{array}{l} t_1 := x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)\right)\\ \mathbf{if}\;y \leq -4.6 \cdot 10^{-23}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-72}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{+153}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + \left(t - x\right) \cdot z\\ \end{array} \]
Alternative 3
Error21.7
Cost848
\[\begin{array}{l} t_1 := \left(t - x\right) \cdot z\\ \mathbf{if}\;x \leq -2.3 \cdot 10^{-120}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -5.1 \cdot 10^{-162}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{-263}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-233}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error22.0
Cost720
\[\begin{array}{l} \mathbf{if}\;x \leq -3.05 \cdot 10^{-120}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -2.9 \cdot 10^{-146}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{-263}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 10^{-235}:\\ \;\;\;\;t \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error22.7
Cost720
\[\begin{array}{l} t_1 := x \cdot \left(1 - z\right)\\ \mathbf{if}\;y \leq -3.3 \cdot 10^{+213}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.85 \cdot 10^{+202}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;y \leq -1.5 \cdot 10^{+37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{+198}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \]
Alternative 6
Error15.1
Cost712
\[\begin{array}{l} t_1 := x + \left(t - x\right) \cdot z\\ \mathbf{if}\;y \leq -5 \cdot 10^{+37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+96}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error18.4
Cost584
\[\begin{array}{l} t_1 := t \cdot z + x\\ \mathbf{if}\;y \leq -4.8 \cdot 10^{+125}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.4 \cdot 10^{+180}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error22.4
Cost64
\[x \]

Error

Reproduce?

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