Average Error: 4.1 → 1.3
Time: 38.2s
Precision: binary64
Cost: 13760
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
\[x + z \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot y - \tanh \left(\frac{x}{y}\right) \cdot y\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 (* z (- (* (tanh (/ t y)) y) (* (tanh (/ x y)) 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 + (z * ((tanh((t / y)) * y) - (tanh((x / y)) * 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 + (z * ((tanh((t / y)) * y) - (tanh((x / y)) * 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 + (z * ((Math.tanh((t / y)) * y) - (Math.tanh((x / y)) * 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 + (z * ((math.tanh((t / y)) * y) - (math.tanh((x / y)) * 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(z * Float64(Float64(tanh(Float64(t / y)) * y) - Float64(tanh(Float64(x / y)) * 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 + (z * ((tanh((t / y)) * y) - (tanh((x / y)) * 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[(z * N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision] - N[(N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision] * y), $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 + z \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot y - \tanh \left(\frac{x}{y}\right) \cdot y\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original4.1
Target1.8
Herbie1.3
\[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.1

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

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

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

Alternatives

Alternative 1
Error4.1
Cost13632
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
Alternative 2
Error1.8
Cost13632
\[x + \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot y \]
Alternative 3
Error1.3
Cost13632
\[x + \left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z \]
Alternative 4
Error16.1
Cost7624
\[\begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+65}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{+76}:\\ \;\;\;\;x + z \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot y - 0.5 \cdot \left(y \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(1 - \tanh \left(\frac{x}{y}\right) \cdot y\right) \cdot z\\ \end{array} \]
Alternative 5
Error17.6
Cost7368
\[\begin{array}{l} t_1 := x + z \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot y - -0.5\right)\\ \mathbf{if}\;y \leq -4.6 \cdot 10^{+17}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{-28}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error19.9
Cost7368
\[\begin{array}{l} \mathbf{if}\;t \leq -0.021:\\ \;\;\;\;x + z \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot y - 0.5\right)\\ \mathbf{elif}\;t \leq 3.9 \cdot 10^{-85}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \left(t - \tanh \left(\frac{x}{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error15.7
Cost7368
\[\begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+65}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-85}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error15.2
Cost7368
\[\begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+65}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-85}:\\ \;\;\;\;x + \left(\left(\tanh \left(\frac{t}{y}\right) - x\right) \cdot y\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Error16.1
Cost7368
\[\begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+65}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+75}:\\ \;\;\;\;x + \left(\left(\tanh \left(\frac{t}{y}\right) - x\right) \cdot y\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \left(1 - \tanh \left(\frac{x}{y}\right) \cdot y\right) \cdot z\\ \end{array} \]
Alternative 10
Error22.3
Cost64
\[x \]

Error

Reproduce

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