Average Error: 4.7 → 1.9
Time: 16.1s
Precision: binary64
Cost: 13632
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
\[x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \]
(FPCore (x y z t)
 :precision binary64
 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
(FPCore (x y z t)
 :precision binary64
 (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))))
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) {
	return x + (y * (z * (tanh((t / y)) - tanh((x / y)))));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x + ((y * z) * (tanh((t / y)) - tanh((x / y))))
end function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x + (y * (z * (tanh((t / y)) - tanh((x / y)))))
end function
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) {
	return x + (y * (z * (Math.tanh((t / y)) - Math.tanh((x / y)))));
}
def code(x, y, z, t):
	return x + ((y * z) * (math.tanh((t / y)) - math.tanh((x / y))))
def code(x, y, z, t):
	return x + (y * (z * (math.tanh((t / y)) - math.tanh((x / y)))))
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)
	return Float64(x + Float64(y * Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))))))
end
function tmp = code(x, y, z, t)
	tmp = x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
end
function tmp = code(x, y, z, t)
	tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y)))));
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_] := N[(x + N[(y * N[(z * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $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)
x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 4.7

    \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
  2. Applied egg-rr1.9

    \[\leadsto x + \color{blue}{\left(0 + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\right)} \]
  3. Final simplification1.9

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

Alternatives

Alternative 1
Error2.2
Cost41032
\[\begin{array}{l} t_1 := z \cdot \left(t - x\right)\\ t_2 := x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_2 \leq \infty:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error12.8
Cost7760
\[\begin{array}{l} t_1 := x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)\\ t_2 := x + z \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -9.158448293998407 \cdot 10^{+81}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -4.021412497819837 \cdot 10^{-93}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 16224016139189028:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 10^{+135}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error12.6
Cost7760
\[\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}\;x \leq -1.7715089082217477 \cdot 10^{+90}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 9.327277239546644 \cdot 10^{-77}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.0990637036197777 \cdot 10^{+45}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 9.60917067771279 \cdot 10^{+94}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error11.8
Cost7760
\[\begin{array}{l} t_1 := \tanh \left(\frac{t}{y}\right) - \frac{x}{y}\\ \mathbf{if}\;x \leq -1.7715089082217477 \cdot 10^{+90}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4.887156664127385 \cdot 10^{-53}:\\ \;\;\;\;x + z \cdot \left(y \cdot t_1\right)\\ \mathbf{elif}\;x \leq 2.0990637036197777 \cdot 10^{+45}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 9.60917067771279 \cdot 10^{+94}:\\ \;\;\;\;x + y \cdot \left(z \cdot t_1\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error15.7
Cost1100
\[\begin{array}{l} t_1 := x + z \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -1.8796762797127602 \cdot 10^{+107}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.1378554762560274 \cdot 10^{+35}:\\ \;\;\;\;x + z \cdot t\\ \mathbf{elif}\;y \leq -0.00030247103939522294:\\ \;\;\;\;x + \frac{\left(y \cdot z\right) \cdot \left(t - x\right)}{y}\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{+130}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error15.7
Cost976
\[\begin{array}{l} t_1 := x + z \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -1.8796762797127602 \cdot 10^{+107}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.1378554762560274 \cdot 10^{+35}:\\ \;\;\;\;x + z \cdot t\\ \mathbf{elif}\;y \leq -0.00030247103939522294:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{+130}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error20.9
Cost848
\[\begin{array}{l} t_1 := x - x \cdot z\\ \mathbf{if}\;y \leq -4.5 \cdot 10^{+295}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -4.3 \cdot 10^{+231}:\\ \;\;\;\;z \cdot t\\ \mathbf{elif}\;y \leq -1.8796762797127602 \cdot 10^{+107}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{+141}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error21.2
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -2.85 \cdot 10^{+212}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{+141}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot z\\ \end{array} \]
Alternative 9
Error18.3
Cost584
\[\begin{array}{l} t_1 := x + z \cdot t\\ \mathbf{if}\;y \leq -15739998423.077587:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{+124}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error23.0
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -9.978559651284736 \cdot 10^{-161}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 6.102253074214164 \cdot 10^{-213}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 11
Error22.7
Cost64
\[x \]

Error

Reproduce

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