SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.7% → 98.1%
Time: 13.0s
Alternatives: 9
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \end{array} \]
(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))));
}
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))));
}
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 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]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 93.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \end{array} \]
(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))));
}
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))));
}
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 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]
\begin{array}{l}

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

Alternative 1: 98.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot z \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ x (* (* y (- (tanh (/ t y)) (tanh (/ x y)))) z)))
double code(double x, double y, double z, double t) {
	return x + ((y * (tanh((t / y)) - tanh((x / y)))) * z);
}
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 * (tanh((t / y)) - tanh((x / y)))) * z)
end function
public static double code(double x, double y, double z, double t) {
	return x + ((y * (Math.tanh((t / y)) - Math.tanh((x / y)))) * z);
}
def code(x, y, z, t):
	return x + ((y * (math.tanh((t / y)) - math.tanh((x / y)))) * z)
function code(x, y, z, t)
	return Float64(x + Float64(Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))) * z))
end
function tmp = code(x, y, z, t)
	tmp = x + ((y * (tanh((t / y)) - tanh((x / y)))) * z);
end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot z
\end{array}
Derivation
  1. Initial program 95.1%

    \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative95.1%

      \[\leadsto x + \color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)} \]
    2. associate-*r*98.4%

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

    \[\leadsto x + \color{blue}{\left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z} \]
  5. Final simplification98.4%

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

Alternative 2: 96.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\ \mathbf{if}\;t\_1 \leq 4 \cdot 10^{+303}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (* (- (tanh (/ t y)) (tanh (/ x y))) (* y z)))))
   (if (<= t_1 4e+303) t_1 (+ x (* z (- t x))))))
double code(double x, double y, double z, double t) {
	double t_1 = x + ((tanh((t / y)) - tanh((x / y))) * (y * z));
	double tmp;
	if (t_1 <= 4e+303) {
		tmp = t_1;
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x + ((tanh((t / y)) - tanh((x / y))) * (y * z))
    if (t_1 <= 4d+303) then
        tmp = t_1
    else
        tmp = x + (z * (t - x))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x + ((Math.tanh((t / y)) - Math.tanh((x / y))) * (y * z));
	double tmp;
	if (t_1 <= 4e+303) {
		tmp = t_1;
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + ((math.tanh((t / y)) - math.tanh((x / y))) * (y * z))
	tmp = 0
	if t_1 <= 4e+303:
		tmp = t_1
	else:
		tmp = x + (z * (t - x))
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))) * Float64(y * z)))
	tmp = 0.0
	if (t_1 <= 4e+303)
		tmp = t_1;
	else
		tmp = Float64(x + Float64(z * Float64(t - x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + ((tanh((t / y)) - tanh((x / y))) * (y * z));
	tmp = 0.0;
	if (t_1 <= 4e+303)
		tmp = t_1;
	else
		tmp = x + (z * (t - x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 4e+303], t$95$1, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\
\mathbf{if}\;t\_1 \leq 4 \cdot 10^{+303}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
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))))) < 4e303

    1. Initial program 98.4%

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

    if 4e303 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

    1. Initial program 38.5%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 93.4%

      \[\leadsto x + \color{blue}{z \cdot \left(t - x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right) \leq 4 \cdot 10^{+303}:\\ \;\;\;\;x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 68.5% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3.4 \cdot 10^{-96}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9.2 \cdot 10^{-75}:\\ \;\;\;\;y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z\right)\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{+59}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y 3.4e-96)
   x
   (if (<= y 9.2e-75)
     (* y (* (tanh (/ t y)) z))
     (if (<= y 2.5e+59) x (+ x (* z (- t x)))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 3.4e-96) {
		tmp = x;
	} else if (y <= 9.2e-75) {
		tmp = y * (tanh((t / y)) * z);
	} else if (y <= 2.5e+59) {
		tmp = x;
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
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
    real(8) :: tmp
    if (y <= 3.4d-96) then
        tmp = x
    else if (y <= 9.2d-75) then
        tmp = y * (tanh((t / y)) * z)
    else if (y <= 2.5d+59) then
        tmp = x
    else
        tmp = x + (z * (t - x))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 3.4e-96) {
		tmp = x;
	} else if (y <= 9.2e-75) {
		tmp = y * (Math.tanh((t / y)) * z);
	} else if (y <= 2.5e+59) {
		tmp = x;
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 3.4e-96:
		tmp = x
	elif y <= 9.2e-75:
		tmp = y * (math.tanh((t / y)) * z)
	elif y <= 2.5e+59:
		tmp = x
	else:
		tmp = x + (z * (t - x))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 3.4e-96)
		tmp = x;
	elseif (y <= 9.2e-75)
		tmp = Float64(y * Float64(tanh(Float64(t / y)) * z));
	elseif (y <= 2.5e+59)
		tmp = x;
	else
		tmp = Float64(x + Float64(z * Float64(t - x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 3.4e-96)
		tmp = x;
	elseif (y <= 9.2e-75)
		tmp = y * (tanh((t / y)) * z);
	elseif (y <= 2.5e+59)
		tmp = x;
	else
		tmp = x + (z * (t - x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 3.4e-96], x, If[LessEqual[y, 9.2e-75], N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e+59], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.4 \cdot 10^{-96}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 9.2 \cdot 10^{-75}:\\
\;\;\;\;y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z\right)\\

\mathbf{elif}\;y \leq 2.5 \cdot 10^{+59}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 3.4000000000000001e-96 or 9.2e-75 < y < 2.4999999999999999e59

    1. Initial program 98.5%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 27.3%

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*27.2%

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)} \]
      2. associate-/r*27.2%

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \color{blue}{\frac{\frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}}\right) \]
      3. div-sub27.2%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}} \]
      4. rec-exp27.2%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - \color{blue}{e^{-\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} \]
      5. rec-exp27.2%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - e^{-\frac{t}{y}}}{e^{\frac{t}{y}} + \color{blue}{e^{-\frac{t}{y}}}} \]
      6. tanh-def-a89.8%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\tanh \left(\frac{t}{y}\right)} \]
    5. Simplified89.8%

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

      \[\leadsto \color{blue}{x} \]

    if 3.4000000000000001e-96 < y < 9.2e-75

    1. Initial program 100.0%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 22.5%

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*22.5%

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)} \]
      2. associate-/r*22.5%

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \color{blue}{\frac{\frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}}\right) \]
      3. div-sub22.5%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}} \]
      4. rec-exp22.5%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - \color{blue}{e^{-\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} \]
      5. rec-exp22.5%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - e^{-\frac{t}{y}}}{e^{\frac{t}{y}} + \color{blue}{e^{-\frac{t}{y}}}} \]
      6. tanh-def-a100.0%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\tanh \left(\frac{t}{y}\right)} \]
    5. Simplified100.0%

      \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right)} \]
    6. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right) + x} \]
      2. associate-*l*100.0%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, z \cdot \tanh \left(\frac{t}{y}\right), x\right)} \]
    7. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, z \cdot \tanh \left(\frac{t}{y}\right), x\right)} \]
    8. Taylor expanded in z around inf 1.1%

      \[\leadsto \color{blue}{\frac{y \cdot \left(z \cdot \left(e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}\right)\right)}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}} \]
    9. Step-by-step derivation
      1. associate-/l*1.1%

        \[\leadsto \color{blue}{y \cdot \frac{z \cdot \left(e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}\right)}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}} \]
      2. associate-/l*1.1%

        \[\leadsto y \cdot \color{blue}{\left(z \cdot \frac{e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}\right)} \]
      3. rec-exp1.1%

        \[\leadsto y \cdot \left(z \cdot \frac{e^{\frac{t}{y}} - \color{blue}{e^{-\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}\right) \]
      4. rec-exp1.1%

        \[\leadsto y \cdot \left(z \cdot \frac{e^{\frac{t}{y}} - e^{-\frac{t}{y}}}{e^{\frac{t}{y}} + \color{blue}{e^{-\frac{t}{y}}}}\right) \]
      5. tanh-def-a72.4%

        \[\leadsto y \cdot \left(z \cdot \color{blue}{\tanh \left(\frac{t}{y}\right)}\right) \]
    10. Simplified72.4%

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

    if 2.4999999999999999e59 < y

    1. Initial program 78.3%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 82.0%

      \[\leadsto x + \color{blue}{z \cdot \left(t - x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification72.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.4 \cdot 10^{-96}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9.2 \cdot 10^{-75}:\\ \;\;\;\;y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z\right)\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{+59}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 82.8% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tanh \left(\frac{t}{y}\right)\\ \mathbf{if}\;y \leq 1.65 \cdot 10^{+102}:\\ \;\;\;\;x + t\_1 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(y \cdot t\_1 - x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (tanh (/ t y))))
   (if (<= y 1.65e+102) (+ x (* t_1 (* y z))) (+ x (* z (- (* y t_1) x))))))
double code(double x, double y, double z, double t) {
	double t_1 = tanh((t / y));
	double tmp;
	if (y <= 1.65e+102) {
		tmp = x + (t_1 * (y * z));
	} else {
		tmp = x + (z * ((y * t_1) - x));
	}
	return tmp;
}
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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = tanh((t / y))
    if (y <= 1.65d+102) then
        tmp = x + (t_1 * (y * z))
    else
        tmp = x + (z * ((y * t_1) - x))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.tanh((t / y));
	double tmp;
	if (y <= 1.65e+102) {
		tmp = x + (t_1 * (y * z));
	} else {
		tmp = x + (z * ((y * t_1) - x));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.tanh((t / y))
	tmp = 0
	if y <= 1.65e+102:
		tmp = x + (t_1 * (y * z))
	else:
		tmp = x + (z * ((y * t_1) - x))
	return tmp
function code(x, y, z, t)
	t_1 = tanh(Float64(t / y))
	tmp = 0.0
	if (y <= 1.65e+102)
		tmp = Float64(x + Float64(t_1 * Float64(y * z)));
	else
		tmp = Float64(x + Float64(z * Float64(Float64(y * t_1) - x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = tanh((t / y));
	tmp = 0.0;
	if (y <= 1.65e+102)
		tmp = x + (t_1 * (y * z));
	else
		tmp = x + (z * ((y * t_1) - x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.65e+102], N[(x + N[(t$95$1 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y * t$95$1), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;y \leq 1.65 \cdot 10^{+102}:\\
\;\;\;\;x + t\_1 \cdot \left(y \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.64999999999999999e102

    1. Initial program 98.2%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 27.4%

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*27.3%

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)} \]
      2. associate-/r*27.3%

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \color{blue}{\frac{\frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}}\right) \]
      3. div-sub27.3%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}} \]
      4. rec-exp27.3%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - \color{blue}{e^{-\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} \]
      5. rec-exp27.3%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - e^{-\frac{t}{y}}}{e^{\frac{t}{y}} + \color{blue}{e^{-\frac{t}{y}}}} \]
      6. tanh-def-a89.4%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\tanh \left(\frac{t}{y}\right)} \]
    5. Simplified89.4%

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

    if 1.64999999999999999e102 < y

    1. Initial program 75.5%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 46.6%

      \[\leadsto x + \color{blue}{\left(-1 \cdot \left(x \cdot z\right) + y \cdot \left(z \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative46.6%

        \[\leadsto x + \color{blue}{\left(y \cdot \left(z \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)\right) + -1 \cdot \left(x \cdot z\right)\right)} \]
    5. Simplified91.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.65 \cdot 10^{+102}:\\ \;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(y \cdot \tanh \left(\frac{t}{y}\right) - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 82.2% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 4.4 \cdot 10^{+98}:\\ \;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y 4.4e+98) (+ x (* (tanh (/ t y)) (* y z))) (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 4.4e+98) {
		tmp = x + (tanh((t / y)) * (y * z));
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
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
    real(8) :: tmp
    if (y <= 4.4d+98) then
        tmp = x + (tanh((t / y)) * (y * z))
    else
        tmp = x + (z * (t - x))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 4.4e+98) {
		tmp = x + (Math.tanh((t / y)) * (y * z));
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 4.4e+98:
		tmp = x + (math.tanh((t / y)) * (y * z))
	else:
		tmp = x + (z * (t - x))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 4.4e+98)
		tmp = Float64(x + Float64(tanh(Float64(t / y)) * Float64(y * z)));
	else
		tmp = Float64(x + Float64(z * Float64(t - x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 4.4e+98)
		tmp = x + (tanh((t / y)) * (y * z));
	else
		tmp = x + (z * (t - x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 4.4e+98], N[(x + N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.4 \cdot 10^{+98}:\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 4.40000000000000017e98

    1. Initial program 98.6%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 27.3%

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*27.2%

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)} \]
      2. associate-/r*27.2%

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \color{blue}{\frac{\frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}}\right) \]
      3. div-sub27.2%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}} \]
      4. rec-exp27.2%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - \color{blue}{e^{-\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} \]
      5. rec-exp27.2%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - e^{-\frac{t}{y}}}{e^{\frac{t}{y}} + \color{blue}{e^{-\frac{t}{y}}}} \]
      6. tanh-def-a89.7%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\tanh \left(\frac{t}{y}\right)} \]
    5. Simplified89.7%

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

    if 4.40000000000000017e98 < y

    1. Initial program 74.9%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 86.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.4 \cdot 10^{+98}:\\ \;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 60.7% accurate, 16.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.15 \cdot 10^{+198}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{+236}:\\ \;\;\;\;t \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y 1.15e+198) x (if (<= y 1.02e+236) (* t z) x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 1.15e+198) {
		tmp = x;
	} else if (y <= 1.02e+236) {
		tmp = t * z;
	} else {
		tmp = x;
	}
	return tmp;
}
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
    real(8) :: tmp
    if (y <= 1.15d+198) then
        tmp = x
    else if (y <= 1.02d+236) then
        tmp = t * z
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 1.15e+198) {
		tmp = x;
	} else if (y <= 1.02e+236) {
		tmp = t * z;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 1.15e+198:
		tmp = x
	elif y <= 1.02e+236:
		tmp = t * z
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 1.15e+198)
		tmp = x;
	elseif (y <= 1.02e+236)
		tmp = Float64(t * z);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 1.15e+198)
		tmp = x;
	elseif (y <= 1.02e+236)
		tmp = t * z;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.15e+198], x, If[LessEqual[y, 1.02e+236], N[(t * z), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.15 \cdot 10^{+198}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 1.02 \cdot 10^{+236}:\\
\;\;\;\;t \cdot z\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.15e198 or 1.01999999999999993e236 < y

    1. Initial program 95.4%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 28.3%

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*28.1%

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)} \]
      2. associate-/r*28.1%

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \color{blue}{\frac{\frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}}\right) \]
      3. div-sub28.1%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}} \]
      4. rec-exp28.1%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - \color{blue}{e^{-\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} \]
      5. rec-exp28.1%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - e^{-\frac{t}{y}}}{e^{\frac{t}{y}} + \color{blue}{e^{-\frac{t}{y}}}} \]
      6. tanh-def-a86.6%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\tanh \left(\frac{t}{y}\right)} \]
    5. Simplified86.6%

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

      \[\leadsto \color{blue}{x} \]

    if 1.15e198 < y < 1.01999999999999993e236

    1. Initial program 75.0%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 26.5%

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*25.4%

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)} \]
      2. associate-/r*25.4%

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \color{blue}{\frac{\frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}}\right) \]
      3. div-sub25.4%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}} \]
      4. rec-exp25.4%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - \color{blue}{e^{-\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} \]
      5. rec-exp25.4%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - e^{-\frac{t}{y}}}{e^{\frac{t}{y}} + \color{blue}{e^{-\frac{t}{y}}}} \]
      6. tanh-def-a75.0%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\tanh \left(\frac{t}{y}\right)} \]
    5. Simplified75.0%

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

      \[\leadsto \color{blue}{z \cdot \left(\frac{x}{z} + \frac{y \cdot \left(e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}\right)}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}\right)} \]
    7. Step-by-step derivation
      1. +-commutative26.3%

        \[\leadsto z \cdot \color{blue}{\left(\frac{y \cdot \left(e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}\right)}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} + \frac{x}{z}\right)} \]
      2. associate-/l*26.3%

        \[\leadsto z \cdot \left(\color{blue}{y \cdot \frac{e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}} + \frac{x}{z}\right) \]
      3. rec-exp26.3%

        \[\leadsto z \cdot \left(y \cdot \frac{e^{\frac{t}{y}} - \color{blue}{e^{-\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} + \frac{x}{z}\right) \]
      4. rec-exp26.3%

        \[\leadsto z \cdot \left(y \cdot \frac{e^{\frac{t}{y}} - e^{-\frac{t}{y}}}{e^{\frac{t}{y}} + \color{blue}{e^{-\frac{t}{y}}}} + \frac{x}{z}\right) \]
      5. tanh-def-a75.9%

        \[\leadsto z \cdot \left(y \cdot \color{blue}{\tanh \left(\frac{t}{y}\right)} + \frac{x}{z}\right) \]
    8. Simplified75.9%

      \[\leadsto \color{blue}{z \cdot \left(y \cdot \tanh \left(\frac{t}{y}\right) + \frac{x}{z}\right)} \]
    9. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{z \cdot \left(t + \frac{x}{z}\right)} \]
    10. Taylor expanded in z around inf 78.0%

      \[\leadsto \color{blue}{t \cdot z} \]
    11. Step-by-step derivation
      1. *-commutative78.0%

        \[\leadsto \color{blue}{z \cdot t} \]
    12. Simplified78.0%

      \[\leadsto \color{blue}{z \cdot t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.15 \cdot 10^{+198}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{+236}:\\ \;\;\;\;t \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 69.5% accurate, 17.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 2.1 \cdot 10^{+60}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y 2.1e+60) x (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.1e+60) {
		tmp = x;
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
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
    real(8) :: tmp
    if (y <= 2.1d+60) then
        tmp = x
    else
        tmp = x + (z * (t - x))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.1e+60) {
		tmp = x;
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 2.1e+60:
		tmp = x
	else:
		tmp = x + (z * (t - x))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 2.1e+60)
		tmp = x;
	else
		tmp = Float64(x + Float64(z * Float64(t - x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 2.1e+60)
		tmp = x;
	else
		tmp = x + (z * (t - x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.1e+60], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.1 \cdot 10^{+60}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 2.1000000000000001e60

    1. Initial program 98.6%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 27.1%

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*27.0%

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)} \]
      2. associate-/r*27.0%

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \color{blue}{\frac{\frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}}\right) \]
      3. div-sub27.0%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}} \]
      4. rec-exp27.0%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - \color{blue}{e^{-\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} \]
      5. rec-exp27.0%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - e^{-\frac{t}{y}}}{e^{\frac{t}{y}} + \color{blue}{e^{-\frac{t}{y}}}} \]
      6. tanh-def-a90.3%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\tanh \left(\frac{t}{y}\right)} \]
    5. Simplified90.3%

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

      \[\leadsto \color{blue}{x} \]

    if 2.1000000000000001e60 < y

    1. Initial program 78.3%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 82.0%

      \[\leadsto x + \color{blue}{z \cdot \left(t - x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 66.3% accurate, 21.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 2.8 \cdot 10^{-16}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z t) :precision binary64 (if (<= y 2.8e-16) x (+ x (* t z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.8e-16) {
		tmp = x;
	} else {
		tmp = x + (t * z);
	}
	return tmp;
}
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
    real(8) :: tmp
    if (y <= 2.8d-16) then
        tmp = x
    else
        tmp = x + (t * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.8e-16) {
		tmp = x;
	} else {
		tmp = x + (t * z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 2.8e-16:
		tmp = x
	else:
		tmp = x + (t * z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 2.8e-16)
		tmp = x;
	else
		tmp = Float64(x + Float64(t * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 2.8e-16)
		tmp = x;
	else
		tmp = x + (t * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.8e-16], x, N[(x + N[(t * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.8 \cdot 10^{-16}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 2.8000000000000001e-16

    1. Initial program 98.5%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 25.9%

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*25.8%

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)} \]
      2. associate-/r*25.8%

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \color{blue}{\frac{\frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}}\right) \]
      3. div-sub25.8%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}} \]
      4. rec-exp25.8%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - \color{blue}{e^{-\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} \]
      5. rec-exp25.8%

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - e^{-\frac{t}{y}}}{e^{\frac{t}{y}} + \color{blue}{e^{-\frac{t}{y}}}} \]
      6. tanh-def-a90.2%

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\tanh \left(\frac{t}{y}\right)} \]
    5. Simplified90.2%

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

      \[\leadsto \color{blue}{x} \]

    if 2.8000000000000001e-16 < y

    1. Initial program 83.2%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 80.0%

      \[\leadsto x + \color{blue}{z \cdot \left(t - x\right)} \]
    4. Taylor expanded in t around inf 68.9%

      \[\leadsto x + \color{blue}{t \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 60.9% accurate, 213.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
	return x;
}
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
end function
public static double code(double x, double y, double z, double t) {
	return x;
}
def code(x, y, z, t):
	return x
function code(x, y, z, t)
	return x
end
function tmp = code(x, y, z, t)
	tmp = x;
end
code[x_, y_, z_, t_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 95.1%

    \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0 28.2%

    \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)\right)} \]
  4. Step-by-step derivation
    1. associate-*r*28.0%

      \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)} \]
    2. associate-/r*28.0%

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \color{blue}{\frac{\frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}}\right) \]
    3. div-sub28.0%

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{e^{\frac{t}{y}} - \frac{1}{e^{\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}}} \]
    4. rec-exp28.0%

      \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - \color{blue}{e^{-\frac{t}{y}}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} \]
    5. rec-exp28.0%

      \[\leadsto x + \left(y \cdot z\right) \cdot \frac{e^{\frac{t}{y}} - e^{-\frac{t}{y}}}{e^{\frac{t}{y}} + \color{blue}{e^{-\frac{t}{y}}}} \]
    6. tanh-def-a86.4%

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\tanh \left(\frac{t}{y}\right)} \]
  5. Simplified86.4%

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

    \[\leadsto \color{blue}{x} \]
  7. Add Preprocessing

Developer target: 97.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \end{array} \]
(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)))));
}
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)))));
}
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(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
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]
\begin{array}{l}

\\
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 2024097 
(FPCore (x y z t)
  :name "SynthBasics:moogVCF from YampaSynth-0.2"
  :precision binary64

  :alt
  (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y))))))

  (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))