SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.7% → 98.7%
Time: 11.3s
Alternatives: 10
Speedup: 0.4×

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 10 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.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \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 10^{+306}:\\ \;\;\;\;\mathsf{fma}\left(z, y \cdot t_1, x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (tanh (/ t y)) (tanh (/ x y)))))
   (if (<= (+ x (* (* y z) t_1)) 1e+306) (fma z (* y t_1) x) (* z (- t x)))))
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)) <= 1e+306) {
		tmp = fma(z, (y * t_1), x);
	} else {
		tmp = z * (t - x);
	}
	return tmp;
}
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)) <= 1e+306)
		tmp = fma(z, Float64(y * t_1), x);
	else
		tmp = Float64(z * Float64(t - x));
	end
	return tmp
end
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], 1e+306], N[(z * N[(y * t$95$1), $MachinePrecision] + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\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 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot t_1, x\right)\\

\mathbf{else}:\\
\;\;\;\;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))))) < 1.00000000000000002e306

    1. Initial program 96.7%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Step-by-step derivation
      1. +-commutative96.7%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)} \]
    3. Simplified99.2%

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

    if 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

    1. Initial program 54.7%

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

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

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

    \[\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 10^{+306}:\\ \;\;\;\;\mathsf{fma}\left(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \end{array} \]

Alternative 2: 98.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\\ \mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 10^{+306}\right):\\ \;\;\;\;z \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y)))))))
   (if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+306))) (* z (- t x)) t_1)))
double code(double x, double y, double z, double t) {
	double t_1 = x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
	double tmp;
	if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 1e+306)) {
		tmp = z * (t - x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = x + ((y * z) * (Math.tanh((t / y)) - Math.tanh((x / y))));
	double tmp;
	if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 1e+306)) {
		tmp = z * (t - x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + ((y * z) * (math.tanh((t / y)) - math.tanh((x / y))))
	tmp = 0
	if (t_1 <= -math.inf) or not (t_1 <= 1e+306):
		tmp = z * (t - x)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(Float64(y * z) * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))))
	tmp = 0.0
	if ((t_1 <= Float64(-Inf)) || !(t_1 <= 1e+306))
		tmp = Float64(z * Float64(t - x));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
	tmp = 0.0;
	if ((t_1 <= -Inf) || ~((t_1 <= 1e+306)))
		tmp = z * (t - x);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = 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]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+306]], $MachinePrecision]], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\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))))) < -inf.0 or 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

    1. Initial program 60.2%

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

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

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

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

    1. Initial program 99.0%

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

    \[\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 \lor \neg \left(x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \leq 10^{+306}\right):\\ \;\;\;\;z \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\\ \end{array} \]

Alternative 3: 82.7% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tanh \left(\frac{t}{y}\right)\\ \mathbf{if}\;y \leq 3.9 \cdot 10^{-53}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot t_1\\ \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 3.9e-53) (+ x (* (* y z) t_1)) (+ 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 <= 3.9e-53) {
		tmp = x + ((y * z) * t_1);
	} 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 <= 3.9d-53) then
        tmp = x + ((y * z) * t_1)
    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 <= 3.9e-53) {
		tmp = x + ((y * z) * t_1);
	} 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 <= 3.9e-53:
		tmp = x + ((y * z) * t_1)
	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 <= 3.9e-53)
		tmp = Float64(x + Float64(Float64(y * z) * t_1));
	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 <= 3.9e-53)
		tmp = x + ((y * z) * t_1);
	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, 3.9e-53], N[(x + N[(N[(y * z), $MachinePrecision] * t$95$1), $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 3.9 \cdot 10^{-53}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot t_1\\

\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 < 3.9000000000000002e-53

    1. Initial program 96.1%

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\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)} \]
    3. Step-by-step derivation
      1. associate-/r*20.7%

        \[\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) \]
      2. rec-exp20.7%

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

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

        \[\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}}}} \]
      5. tanh-def-a84.8%

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

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

    if 3.9000000000000002e-53 < y

    1. Initial program 87.7%

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

      \[\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)} \]
    3. Step-by-step derivation
      1. +-commutative40.9%

        \[\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)} \]
    4. Simplified85.3%

      \[\leadsto x + \color{blue}{z \cdot \mathsf{fma}\left(y, \tanh \left(\frac{t}{y}\right), -x\right)} \]
    5. Taylor expanded in y around 0 42.1%

      \[\leadsto x + z \cdot \color{blue}{\left(-1 \cdot x + y \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)} \]
    6. Step-by-step derivation
      1. mul-1-neg42.1%

        \[\leadsto x + z \cdot \left(\color{blue}{\left(-x\right)} + y \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) \]
      2. +-commutative42.1%

        \[\leadsto x + z \cdot \color{blue}{\left(y \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) + \left(-x\right)\right)} \]
      3. fma-def42.1%

        \[\leadsto x + z \cdot \color{blue}{\mathsf{fma}\left(y, \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)}, -x\right)} \]
    7. Simplified85.3%

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

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

Alternative 4: 82.0% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 96.5%

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\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)} \]
    3. Step-by-step derivation
      1. associate-/r*23.6%

        \[\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) \]
      2. rec-exp23.6%

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

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

        \[\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}}}} \]
      5. tanh-def-a83.6%

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

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

    if 2.1e186 < y

    1. Initial program 72.6%

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

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

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

Alternative 5: 62.3% accurate, 19.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 7.2 \cdot 10^{+61}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{+187} \lor \neg \left(y \leq 4.1 \cdot 10^{+225}\right):\\ \;\;\;\;z \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y 7.2e+61)
   x
   (if (or (<= y 8.2e+187) (not (<= y 4.1e+225)))
     (* z (- t x))
     (* x (- 1.0 z)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 7.2e+61) {
		tmp = x;
	} else if ((y <= 8.2e+187) || !(y <= 4.1e+225)) {
		tmp = z * (t - x);
	} else {
		tmp = x * (1.0 - 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 <= 7.2d+61) then
        tmp = x
    else if ((y <= 8.2d+187) .or. (.not. (y <= 4.1d+225))) then
        tmp = z * (t - x)
    else
        tmp = x * (1.0d0 - z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 7.2e+61) {
		tmp = x;
	} else if ((y <= 8.2e+187) || !(y <= 4.1e+225)) {
		tmp = z * (t - x);
	} else {
		tmp = x * (1.0 - z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 7.2e+61:
		tmp = x
	elif (y <= 8.2e+187) or not (y <= 4.1e+225):
		tmp = z * (t - x)
	else:
		tmp = x * (1.0 - z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 7.2e+61)
		tmp = x;
	elseif ((y <= 8.2e+187) || !(y <= 4.1e+225))
		tmp = Float64(z * Float64(t - x));
	else
		tmp = Float64(x * Float64(1.0 - z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 7.2e+61)
		tmp = x;
	elseif ((y <= 8.2e+187) || ~((y <= 4.1e+225)))
		tmp = z * (t - x);
	else
		tmp = x * (1.0 - z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 7.2e+61], x, If[Or[LessEqual[y, 8.2e+187], N[Not[LessEqual[y, 4.1e+225]], $MachinePrecision]], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 8.2 \cdot 10^{+187} \lor \neg \left(y \leq 4.1 \cdot 10^{+225}\right):\\
\;\;\;\;z \cdot \left(t - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 7.20000000000000021e61

    1. Initial program 96.6%

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

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

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

    if 7.20000000000000021e61 < y < 8.2e187 or 4.0999999999999999e225 < y

    1. Initial program 86.4%

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

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

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

    if 8.2e187 < y < 4.0999999999999999e225

    1. Initial program 72.3%

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot z\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg60.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-z\right)}\right) \]
      2. unsub-neg60.2%

        \[\leadsto x \cdot \color{blue}{\left(1 - z\right)} \]
    5. Simplified60.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 7.2 \cdot 10^{+61}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{+187} \lor \neg \left(y \leq 4.1 \cdot 10^{+225}\right):\\ \;\;\;\;z \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \end{array} \]

Alternative 6: 59.3% accurate, 23.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3.2 \cdot 10^{+98} \lor \neg \left(y \leq 5.4 \cdot 10^{+187}\right) \land y \leq 4.1 \cdot 10^{+225}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y 3.2e+98) (and (not (<= y 5.4e+187)) (<= y 4.1e+225)))
   x
   (* z t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= 3.2e+98) || (!(y <= 5.4e+187) && (y <= 4.1e+225))) {
		tmp = x;
	} else {
		tmp = z * t;
	}
	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.2d+98) .or. (.not. (y <= 5.4d+187)) .and. (y <= 4.1d+225)) then
        tmp = x
    else
        tmp = z * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= 3.2e+98) || (!(y <= 5.4e+187) && (y <= 4.1e+225))) {
		tmp = x;
	} else {
		tmp = z * t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= 3.2e+98) or (not (y <= 5.4e+187) and (y <= 4.1e+225)):
		tmp = x
	else:
		tmp = z * t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= 3.2e+98) || (!(y <= 5.4e+187) && (y <= 4.1e+225)))
		tmp = x;
	else
		tmp = Float64(z * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y <= 3.2e+98) || (~((y <= 5.4e+187)) && (y <= 4.1e+225)))
		tmp = x;
	else
		tmp = z * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, 3.2e+98], And[N[Not[LessEqual[y, 5.4e+187]], $MachinePrecision], LessEqual[y, 4.1e+225]]], x, N[(z * t), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.2 \cdot 10^{+98} \lor \neg \left(y \leq 5.4 \cdot 10^{+187}\right) \land y \leq 4.1 \cdot 10^{+225}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3.2000000000000002e98 or 5.40000000000000016e187 < y < 4.0999999999999999e225

    1. Initial program 94.7%

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

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

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

    if 3.2000000000000002e98 < y < 5.40000000000000016e187 or 4.0999999999999999e225 < y

    1. Initial program 85.0%

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

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

      \[\leadsto \color{blue}{x + t \cdot z} \]
    4. Step-by-step derivation
      1. +-commutative71.3%

        \[\leadsto \color{blue}{t \cdot z + x} \]
      2. *-commutative71.3%

        \[\leadsto \color{blue}{z \cdot t} + x \]
    5. Simplified71.3%

      \[\leadsto \color{blue}{z \cdot t + x} \]
    6. Taylor expanded in z around inf 58.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.2 \cdot 10^{+98} \lor \neg \left(y \leq 5.4 \cdot 10^{+187}\right) \land y \leq 4.1 \cdot 10^{+225}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]

Alternative 7: 62.6% accurate, 23.3× speedup?

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

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

\mathbf{elif}\;y \leq 6.2 \cdot 10^{+283}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.15e-48

    1. Initial program 96.1%

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

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

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

    if 1.15e-48 < y < 6.19999999999999976e283

    1. Initial program 89.2%

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot z\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg50.3%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-z\right)}\right) \]
      2. unsub-neg50.3%

        \[\leadsto x \cdot \color{blue}{\left(1 - z\right)} \]
    5. Simplified50.3%

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

    if 6.19999999999999976e283 < y

    1. Initial program 67.6%

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

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

      \[\leadsto \color{blue}{x + t \cdot z} \]
    4. Step-by-step derivation
      1. +-commutative84.4%

        \[\leadsto \color{blue}{t \cdot z + x} \]
      2. *-commutative84.4%

        \[\leadsto \color{blue}{z \cdot t} + x \]
    5. Simplified84.4%

      \[\leadsto \color{blue}{z \cdot t + x} \]
    6. Taylor expanded in z around inf 84.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.15 \cdot 10^{-48}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{+283}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]

Alternative 8: 69.0% accurate, 23.5× speedup?

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

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

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


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

    1. Initial program 96.2%

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

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

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

    if 5.39999999999999975e-30 < y

    1. Initial program 86.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 5.4 \cdot 10^{-30}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \end{array} \]

Alternative 9: 66.0% accurate, 30.2× speedup?

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

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

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


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

    1. Initial program 96.2%

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

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

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

    if 5.39999999999999975e-30 < y

    1. Initial program 86.8%

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

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

      \[\leadsto \color{blue}{x + t \cdot z} \]
    4. Step-by-step derivation
      1. +-commutative62.5%

        \[\leadsto \color{blue}{t \cdot z + x} \]
      2. *-commutative62.5%

        \[\leadsto \color{blue}{z \cdot t} + x \]
    5. Simplified62.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 5.4 \cdot 10^{-30}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot t\\ \end{array} \]

Alternative 10: 60.5% 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 93.2%

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

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

    \[\leadsto \color{blue}{x} \]
  4. Final simplification53.8%

    \[\leadsto x \]

Developer target: 97.0% 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 2023332 
(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))))))