SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.9% → 98.7%
Time: 12.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.9% 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, 1.0× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 1.4 \cdot 10^{+227}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y\_m}\right), y\_m, \tanh \left(\frac{x}{y\_m}\right) \cdot \left(-y\_m\right)\right), z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
 :precision binary64
 (if (<= y_m 1.4e+227)
   (fma (fma (tanh (/ t y_m)) y_m (* (tanh (/ x y_m)) (- y_m))) z x)
   (fma z (- t x) x)))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
	double tmp;
	if (y_m <= 1.4e+227) {
		tmp = fma(fma(tanh((t / y_m)), y_m, (tanh((x / y_m)) * -y_m)), z, x);
	} else {
		tmp = fma(z, (t - x), x);
	}
	return tmp;
}
y_m = abs(y)
function code(x, y_m, z, t)
	tmp = 0.0
	if (y_m <= 1.4e+227)
		tmp = fma(fma(tanh(Float64(t / y_m)), y_m, Float64(tanh(Float64(x / y_m)) * Float64(-y_m))), z, x);
	else
		tmp = fma(z, Float64(t - x), x);
	end
	return tmp
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 1.4e+227], N[(N[(N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] * y$95$m + N[(N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision] * (-y$95$m)), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 1.4 \cdot 10^{+227}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y\_m}\right), y\_m, \tanh \left(\frac{x}{y\_m}\right) \cdot \left(-y\_m\right)\right), z, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\


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

    1. Initial program 92.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. Step-by-step derivation
      1. +-commutativeN/A

        \[\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. *-commutativeN/A

        \[\leadsto \color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)} + x \]
      3. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z} + x \]
      4. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y, z, x\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y}, z, x\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \cdot y, z, x\right) \]
      7. tanh-lowering-tanh.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\color{blue}{\tanh \left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \cdot y, z, x\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \cdot y, z, x\right) \]
      9. tanh-lowering-tanh.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\tanh \left(\frac{x}{y}\right)}\right) \cdot y, z, x\right) \]
      10. /-lowering-/.f6497.2

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y, z, x\right)} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)}, z, x\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{fma}\left(y \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) + \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right)\right)}, z, x\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\tanh \left(\frac{t}{y}\right) \cdot y + \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot y}, z, x\right) \]
      4. accelerator-lowering-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot y\right)}, z, x\right) \]
      5. tanh-lowering-tanh.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\tanh \left(\frac{t}{y}\right)}, y, \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot y\right), z, x\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \color{blue}{\left(\frac{t}{y}\right)}, y, \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot y\right), z, x\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, \color{blue}{\left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot y}\right), z, x\right) \]
      8. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, \color{blue}{\left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right)} \cdot y\right), z, x\right) \]
      9. tanh-lowering-tanh.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, \left(\mathsf{neg}\left(\color{blue}{\tanh \left(\frac{x}{y}\right)}\right)\right) \cdot y\right), z, x\right) \]
      10. /-lowering-/.f6497.2

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

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

    if 1.39999999999999992e227 < y

    1. Initial program 56.7%

      \[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

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. --lowering--.f6491.2

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified91.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.8%

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

Alternative 2: 72.5% accurate, 0.5× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_1 := z \cdot \left(t - x\right)\\ t_2 := x + \left(\tanh \left(\frac{t}{y\_m}\right) - \tanh \left(\frac{x}{y\_m}\right)\right) \cdot \left(y\_m \cdot z\right)\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+307}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
 :precision binary64
 (let* ((t_1 (* z (- t x)))
        (t_2 (+ x (* (- (tanh (/ t y_m)) (tanh (/ x y_m))) (* y_m z)))))
   (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 1e+307) x t_1))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
	double t_1 = z * (t - x);
	double t_2 = x + ((tanh((t / y_m)) - tanh((x / y_m))) * (y_m * z));
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = t_1;
	} else if (t_2 <= 1e+307) {
		tmp = x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
	double t_1 = z * (t - x);
	double t_2 = x + ((Math.tanh((t / y_m)) - Math.tanh((x / y_m))) * (y_m * z));
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else if (t_2 <= 1e+307) {
		tmp = x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z, t):
	t_1 = z * (t - x)
	t_2 = x + ((math.tanh((t / y_m)) - math.tanh((x / y_m))) * (y_m * z))
	tmp = 0
	if t_2 <= -math.inf:
		tmp = t_1
	elif t_2 <= 1e+307:
		tmp = x
	else:
		tmp = t_1
	return tmp
y_m = abs(y)
function code(x, y_m, z, t)
	t_1 = Float64(z * Float64(t - x))
	t_2 = Float64(x + Float64(Float64(tanh(Float64(t / y_m)) - tanh(Float64(x / y_m))) * Float64(y_m * z)))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = t_1;
	elseif (t_2 <= 1e+307)
		tmp = x;
	else
		tmp = t_1;
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z, t)
	t_1 = z * (t - x);
	t_2 = x + ((tanh((t / y_m)) - tanh((x / y_m))) * (y_m * z));
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = t_1;
	elseif (t_2 <= 1e+307)
		tmp = x;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1e+307], x, t$95$1]]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
t_1 := z \cdot \left(t - x\right)\\
t_2 := x + \left(\tanh \left(\frac{t}{y\_m}\right) - \tanh \left(\frac{x}{y\_m}\right)\right) \cdot \left(y\_m \cdot z\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+307}:\\
\;\;\;\;x\\

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

    1. Initial program 32.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

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
      2. --lowering--.f6432.5

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

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

      \[\leadsto \color{blue}{z \cdot \left(t - x\right)} \]
    7. Step-by-step derivation
      1. remove-double-negN/A

        \[\leadsto z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(t - x\right)\right)\right)\right)\right)} \]
      2. mul-1-negN/A

        \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(t - x\right)}\right)\right) \]
      3. distribute-lft-out--N/A

        \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(-1 \cdot t - -1 \cdot x\right)}\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto z \cdot \color{blue}{\left(-1 \cdot \left(-1 \cdot t - -1 \cdot x\right)\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{z \cdot \left(-1 \cdot \left(-1 \cdot t - -1 \cdot x\right)\right)} \]
      6. mul-1-negN/A

        \[\leadsto z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot t - -1 \cdot x\right)\right)\right)} \]
      7. distribute-lft-out--N/A

        \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(t - x\right)}\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(t - x\right)\right)\right)}\right)\right) \]
      9. remove-double-negN/A

        \[\leadsto z \cdot \color{blue}{\left(t - x\right)} \]
      10. --lowering--.f6494.9

        \[\leadsto z \cdot \color{blue}{\left(t - x\right)} \]
    8. Simplified94.9%

      \[\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))))) < 9.99999999999999986e306

    1. Initial program 99.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 inf

      \[\leadsto \color{blue}{x} \]
    4. Step-by-step derivation
      1. Simplified66.9%

        \[\leadsto \color{blue}{x} \]
    5. Recombined 2 regimes into one program.
    6. Final simplification70.9%

      \[\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 -\infty:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \mathbf{elif}\;x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right) \leq 10^{+307}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \end{array} \]
    7. Add Preprocessing

    Alternative 3: 67.0% accurate, 0.5× speedup?

    \[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_1 := -x \cdot z\\ t_2 := x + \left(\tanh \left(\frac{t}{y\_m}\right) - \tanh \left(\frac{x}{y\_m}\right)\right) \cdot \left(y\_m \cdot z\right)\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+307}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    y_m = (fabs.f64 y)
    (FPCore (x y_m z t)
     :precision binary64
     (let* ((t_1 (- (* x z)))
            (t_2 (+ x (* (- (tanh (/ t y_m)) (tanh (/ x y_m))) (* y_m z)))))
       (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 1e+307) x t_1))))
    y_m = fabs(y);
    double code(double x, double y_m, double z, double t) {
    	double t_1 = -(x * z);
    	double t_2 = x + ((tanh((t / y_m)) - tanh((x / y_m))) * (y_m * z));
    	double tmp;
    	if (t_2 <= -((double) INFINITY)) {
    		tmp = t_1;
    	} else if (t_2 <= 1e+307) {
    		tmp = x;
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    y_m = Math.abs(y);
    public static double code(double x, double y_m, double z, double t) {
    	double t_1 = -(x * z);
    	double t_2 = x + ((Math.tanh((t / y_m)) - Math.tanh((x / y_m))) * (y_m * z));
    	double tmp;
    	if (t_2 <= -Double.POSITIVE_INFINITY) {
    		tmp = t_1;
    	} else if (t_2 <= 1e+307) {
    		tmp = x;
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    y_m = math.fabs(y)
    def code(x, y_m, z, t):
    	t_1 = -(x * z)
    	t_2 = x + ((math.tanh((t / y_m)) - math.tanh((x / y_m))) * (y_m * z))
    	tmp = 0
    	if t_2 <= -math.inf:
    		tmp = t_1
    	elif t_2 <= 1e+307:
    		tmp = x
    	else:
    		tmp = t_1
    	return tmp
    
    y_m = abs(y)
    function code(x, y_m, z, t)
    	t_1 = Float64(-Float64(x * z))
    	t_2 = Float64(x + Float64(Float64(tanh(Float64(t / y_m)) - tanh(Float64(x / y_m))) * Float64(y_m * z)))
    	tmp = 0.0
    	if (t_2 <= Float64(-Inf))
    		tmp = t_1;
    	elseif (t_2 <= 1e+307)
    		tmp = x;
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    y_m = abs(y);
    function tmp_2 = code(x, y_m, z, t)
    	t_1 = -(x * z);
    	t_2 = x + ((tanh((t / y_m)) - tanh((x / y_m))) * (y_m * z));
    	tmp = 0.0;
    	if (t_2 <= -Inf)
    		tmp = t_1;
    	elseif (t_2 <= 1e+307)
    		tmp = x;
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    y_m = N[Abs[y], $MachinePrecision]
    code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = (-N[(x * z), $MachinePrecision])}, Block[{t$95$2 = N[(x + N[(N[(N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1e+307], x, t$95$1]]]]
    
    \begin{array}{l}
    y_m = \left|y\right|
    
    \\
    \begin{array}{l}
    t_1 := -x \cdot z\\
    t_2 := x + \left(\tanh \left(\frac{t}{y\_m}\right) - \tanh \left(\frac{x}{y\_m}\right)\right) \cdot \left(y\_m \cdot z\right)\\
    \mathbf{if}\;t\_2 \leq -\infty:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;t\_2 \leq 10^{+307}:\\
    \;\;\;\;x\\
    
    \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 9.99999999999999986e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

      1. Initial program 32.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

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\frac{x}{y}}\right) \]
      4. Step-by-step derivation
        1. /-lowering-/.f6432.4

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

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

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

          \[\leadsto \color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) \cdot \left(y \cdot z\right)} + x \]
        3. associate-*r*N/A

          \[\leadsto \color{blue}{\left(\left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) \cdot y\right) \cdot z} + x \]
        4. accelerator-lowering-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) \cdot y, z, x\right)} \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) \cdot y}, z, x\right) \]
        6. --lowering--.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)} \cdot y, z, x\right) \]
        7. tanh-lowering-tanh.f64N/A

          \[\leadsto \mathsf{fma}\left(\left(\color{blue}{\tanh \left(\frac{t}{y}\right)} - \frac{x}{y}\right) \cdot y, z, x\right) \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \frac{x}{y}\right) \cdot y, z, x\right) \]
        9. /-lowering-/.f6474.4

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(-1 \cdot \frac{x}{y}\right)} \cdot y, z, x\right) \]
      9. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \cdot y, z, x\right) \]
        2. neg-lowering-neg.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \cdot y, z, x\right) \]
        3. /-lowering-/.f6459.1

          \[\leadsto \mathsf{fma}\left(\left(-\color{blue}{\frac{x}{y}}\right) \cdot y, z, x\right) \]
      10. Simplified59.1%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(-\frac{x}{y}\right)} \cdot y, z, x\right) \]
      11. Taylor expanded in z around inf

        \[\leadsto \color{blue}{-1 \cdot \left(x \cdot z\right)} \]
      12. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot z\right)} \]
        2. distribute-rgt-neg-inN/A

          \[\leadsto \color{blue}{x \cdot \left(\mathsf{neg}\left(z\right)\right)} \]
        3. mul-1-negN/A

          \[\leadsto x \cdot \color{blue}{\left(-1 \cdot z\right)} \]
        4. *-lowering-*.f64N/A

          \[\leadsto \color{blue}{x \cdot \left(-1 \cdot z\right)} \]
        5. mul-1-negN/A

          \[\leadsto x \cdot \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \]
        6. neg-lowering-neg.f6469.2

          \[\leadsto x \cdot \color{blue}{\left(-z\right)} \]
      13. Simplified69.2%

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

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

      1. Initial program 99.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 inf

        \[\leadsto \color{blue}{x} \]
      4. Step-by-step derivation
        1. Simplified66.9%

          \[\leadsto \color{blue}{x} \]
      5. Recombined 2 regimes into one program.
      6. Final simplification67.2%

        \[\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 -\infty:\\ \;\;\;\;-x \cdot z\\ \mathbf{elif}\;x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right) \leq 10^{+307}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;-x \cdot z\\ \end{array} \]
      7. Add Preprocessing

      Alternative 4: 98.7% accurate, 1.0× speedup?

      \[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 3.3 \cdot 10^{+226}:\\ \;\;\;\;\mathsf{fma}\left(y\_m \cdot \left(\tanh \left(\frac{t}{y\_m}\right) - \tanh \left(\frac{x}{y\_m}\right)\right), z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\ \end{array} \end{array} \]
      y_m = (fabs.f64 y)
      (FPCore (x y_m z t)
       :precision binary64
       (if (<= y_m 3.3e+226)
         (fma (* y_m (- (tanh (/ t y_m)) (tanh (/ x y_m)))) z x)
         (fma z (- t x) x)))
      y_m = fabs(y);
      double code(double x, double y_m, double z, double t) {
      	double tmp;
      	if (y_m <= 3.3e+226) {
      		tmp = fma((y_m * (tanh((t / y_m)) - tanh((x / y_m)))), z, x);
      	} else {
      		tmp = fma(z, (t - x), x);
      	}
      	return tmp;
      }
      
      y_m = abs(y)
      function code(x, y_m, z, t)
      	tmp = 0.0
      	if (y_m <= 3.3e+226)
      		tmp = fma(Float64(y_m * Float64(tanh(Float64(t / y_m)) - tanh(Float64(x / y_m)))), z, x);
      	else
      		tmp = fma(z, Float64(t - x), x);
      	end
      	return tmp
      end
      
      y_m = N[Abs[y], $MachinePrecision]
      code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 3.3e+226], N[(N[(y$95$m * N[(N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
      
      \begin{array}{l}
      y_m = \left|y\right|
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y\_m \leq 3.3 \cdot 10^{+226}:\\
      \;\;\;\;\mathsf{fma}\left(y\_m \cdot \left(\tanh \left(\frac{t}{y\_m}\right) - \tanh \left(\frac{x}{y\_m}\right)\right), z, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < 3.29999999999999978e226

        1. Initial program 92.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. Step-by-step derivation
          1. +-commutativeN/A

            \[\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. *-commutativeN/A

            \[\leadsto \color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)} + x \]
          3. associate-*r*N/A

            \[\leadsto \color{blue}{\left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z} + x \]
          4. accelerator-lowering-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y, z, x\right)} \]
          5. *-lowering-*.f64N/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y}, z, x\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \cdot y, z, x\right) \]
          7. tanh-lowering-tanh.f64N/A

            \[\leadsto \mathsf{fma}\left(\left(\color{blue}{\tanh \left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \cdot y, z, x\right) \]
          8. /-lowering-/.f64N/A

            \[\leadsto \mathsf{fma}\left(\left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \cdot y, z, x\right) \]
          9. tanh-lowering-tanh.f64N/A

            \[\leadsto \mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\tanh \left(\frac{x}{y}\right)}\right) \cdot y, z, x\right) \]
          10. /-lowering-/.f6497.2

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

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

        if 3.29999999999999978e226 < y

        1. Initial program 56.7%

          \[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

          \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
          2. accelerator-lowering-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
          3. --lowering--.f6491.2

            \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
        5. Simplified91.2%

          \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. Recombined 2 regimes into one program.
      4. Final simplification96.8%

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

      Alternative 5: 98.3% accurate, 1.0× speedup?

      \[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 3.65 \cdot 10^{+224}:\\ \;\;\;\;\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y\_m}\right) - \tanh \left(\frac{x}{y\_m}\right)\right), y\_m, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\ \end{array} \end{array} \]
      y_m = (fabs.f64 y)
      (FPCore (x y_m z t)
       :precision binary64
       (if (<= y_m 3.65e+224)
         (fma (* z (- (tanh (/ t y_m)) (tanh (/ x y_m)))) y_m x)
         (fma z (- t x) x)))
      y_m = fabs(y);
      double code(double x, double y_m, double z, double t) {
      	double tmp;
      	if (y_m <= 3.65e+224) {
      		tmp = fma((z * (tanh((t / y_m)) - tanh((x / y_m)))), y_m, x);
      	} else {
      		tmp = fma(z, (t - x), x);
      	}
      	return tmp;
      }
      
      y_m = abs(y)
      function code(x, y_m, z, t)
      	tmp = 0.0
      	if (y_m <= 3.65e+224)
      		tmp = fma(Float64(z * Float64(tanh(Float64(t / y_m)) - tanh(Float64(x / y_m)))), y_m, x);
      	else
      		tmp = fma(z, Float64(t - x), x);
      	end
      	return tmp
      end
      
      y_m = N[Abs[y], $MachinePrecision]
      code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 3.65e+224], N[(N[(z * N[(N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y$95$m + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
      
      \begin{array}{l}
      y_m = \left|y\right|
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y\_m \leq 3.65 \cdot 10^{+224}:\\
      \;\;\;\;\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y\_m}\right) - \tanh \left(\frac{x}{y\_m}\right)\right), y\_m, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < 3.65000000000000013e224

        1. Initial program 92.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. Step-by-step derivation
          1. +-commutativeN/A

            \[\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. associate-*l*N/A

            \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} + x \]
          3. *-commutativeN/A

            \[\leadsto \color{blue}{\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot y} + x \]
          4. accelerator-lowering-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), y, x\right)} \]
          5. *-lowering-*.f64N/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)}, y, x\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{fma}\left(z \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)}, y, x\right) \]
          7. tanh-lowering-tanh.f64N/A

            \[\leadsto \mathsf{fma}\left(z \cdot \left(\color{blue}{\tanh \left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right), y, x\right) \]
          8. /-lowering-/.f64N/A

            \[\leadsto \mathsf{fma}\left(z \cdot \left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right), y, x\right) \]
          9. tanh-lowering-tanh.f64N/A

            \[\leadsto \mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\tanh \left(\frac{x}{y}\right)}\right), y, x\right) \]
          10. /-lowering-/.f6496.4

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

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

        if 3.65000000000000013e224 < y

        1. Initial program 56.7%

          \[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

          \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
          2. accelerator-lowering-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
          3. --lowering--.f6491.2

            \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
        5. Simplified91.2%

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

      Alternative 6: 84.2% accurate, 1.8× speedup?

      \[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 1.05 \cdot 10^{-86}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y\_m}\right), y\_m, -x\right), z, x\right)\\ \end{array} \end{array} \]
      y_m = (fabs.f64 y)
      (FPCore (x y_m z t)
       :precision binary64
       (if (<= y_m 1.05e-86) x (fma (fma (tanh (/ t y_m)) y_m (- x)) z x)))
      y_m = fabs(y);
      double code(double x, double y_m, double z, double t) {
      	double tmp;
      	if (y_m <= 1.05e-86) {
      		tmp = x;
      	} else {
      		tmp = fma(fma(tanh((t / y_m)), y_m, -x), z, x);
      	}
      	return tmp;
      }
      
      y_m = abs(y)
      function code(x, y_m, z, t)
      	tmp = 0.0
      	if (y_m <= 1.05e-86)
      		tmp = x;
      	else
      		tmp = fma(fma(tanh(Float64(t / y_m)), y_m, Float64(-x)), z, x);
      	end
      	return tmp
      end
      
      y_m = N[Abs[y], $MachinePrecision]
      code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 1.05e-86], x, N[(N[(N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] * y$95$m + (-x)), $MachinePrecision] * z + x), $MachinePrecision]]
      
      \begin{array}{l}
      y_m = \left|y\right|
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y\_m \leq 1.05 \cdot 10^{-86}:\\
      \;\;\;\;x\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y\_m}\right), y\_m, -x\right), z, x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < 1.05e-86

        1. Initial program 92.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 x around inf

          \[\leadsto \color{blue}{x} \]
        4. Step-by-step derivation
          1. Simplified62.6%

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

          if 1.05e-86 < y

          1. Initial program 81.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. Step-by-step derivation
            1. +-commutativeN/A

              \[\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. *-commutativeN/A

              \[\leadsto \color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)} + x \]
            3. associate-*r*N/A

              \[\leadsto \color{blue}{\left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y\right) \cdot z} + x \]
            4. accelerator-lowering-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y, z, x\right)} \]
            5. *-lowering-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y}, z, x\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \cdot y, z, x\right) \]
            7. tanh-lowering-tanh.f64N/A

              \[\leadsto \mathsf{fma}\left(\left(\color{blue}{\tanh \left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \cdot y, z, x\right) \]
            8. /-lowering-/.f64N/A

              \[\leadsto \mathsf{fma}\left(\left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \cdot y, z, x\right) \]
            9. tanh-lowering-tanh.f64N/A

              \[\leadsto \mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\tanh \left(\frac{x}{y}\right)}\right) \cdot y, z, x\right) \]
            10. /-lowering-/.f6494.7

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y, z, x\right)} \]
          5. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)}, z, x\right) \]
            2. sub-negN/A

              \[\leadsto \mathsf{fma}\left(y \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) + \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right)\right)}, z, x\right) \]
            3. distribute-rgt-inN/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{\tanh \left(\frac{t}{y}\right) \cdot y + \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot y}, z, x\right) \]
            4. accelerator-lowering-fma.f64N/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot y\right)}, z, x\right) \]
            5. tanh-lowering-tanh.f64N/A

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\tanh \left(\frac{t}{y}\right)}, y, \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot y\right), z, x\right) \]
            6. /-lowering-/.f64N/A

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \color{blue}{\left(\frac{t}{y}\right)}, y, \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot y\right), z, x\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, \color{blue}{\left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot y}\right), z, x\right) \]
            8. neg-lowering-neg.f64N/A

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, \color{blue}{\left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right)} \cdot y\right), z, x\right) \]
            9. tanh-lowering-tanh.f64N/A

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, \left(\mathsf{neg}\left(\color{blue}{\tanh \left(\frac{x}{y}\right)}\right)\right) \cdot y\right), z, x\right) \]
            10. /-lowering-/.f6494.7

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

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

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, \color{blue}{-1 \cdot x}\right), z, x\right) \]
          8. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, \color{blue}{\mathsf{neg}\left(x\right)}\right), z, x\right) \]
            2. neg-lowering-neg.f6488.4

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, \color{blue}{-x}\right), z, x\right) \]
          9. Simplified88.4%

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, \color{blue}{-x}\right), z, x\right) \]
        5. Recombined 2 regimes into one program.
        6. Add Preprocessing

        Alternative 7: 78.4% accurate, 14.9× speedup?

        \[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 85:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\ \end{array} \end{array} \]
        y_m = (fabs.f64 y)
        (FPCore (x y_m z t) :precision binary64 (if (<= y_m 85.0) x (fma z (- t x) x)))
        y_m = fabs(y);
        double code(double x, double y_m, double z, double t) {
        	double tmp;
        	if (y_m <= 85.0) {
        		tmp = x;
        	} else {
        		tmp = fma(z, (t - x), x);
        	}
        	return tmp;
        }
        
        y_m = abs(y)
        function code(x, y_m, z, t)
        	tmp = 0.0
        	if (y_m <= 85.0)
        		tmp = x;
        	else
        		tmp = fma(z, Float64(t - x), x);
        	end
        	return tmp
        end
        
        y_m = N[Abs[y], $MachinePrecision]
        code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 85.0], x, N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
        
        \begin{array}{l}
        y_m = \left|y\right|
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y\_m \leq 85:\\
        \;\;\;\;x\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < 85

          1. Initial program 93.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 inf

            \[\leadsto \color{blue}{x} \]
          4. Step-by-step derivation
            1. Simplified62.2%

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

            if 85 < y

            1. Initial program 75.8%

              \[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

              \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
            4. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
              2. accelerator-lowering-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
              3. --lowering--.f6479.7

                \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
            5. Simplified79.7%

              \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
          5. Recombined 2 regimes into one program.
          6. Add Preprocessing

          Alternative 8: 70.0% accurate, 18.4× speedup?

          \[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 6 \cdot 10^{-62}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, z, x\right)\\ \end{array} \end{array} \]
          y_m = (fabs.f64 y)
          (FPCore (x y_m z t) :precision binary64 (if (<= y_m 6e-62) x (fma t z x)))
          y_m = fabs(y);
          double code(double x, double y_m, double z, double t) {
          	double tmp;
          	if (y_m <= 6e-62) {
          		tmp = x;
          	} else {
          		tmp = fma(t, z, x);
          	}
          	return tmp;
          }
          
          y_m = abs(y)
          function code(x, y_m, z, t)
          	tmp = 0.0
          	if (y_m <= 6e-62)
          		tmp = x;
          	else
          		tmp = fma(t, z, x);
          	end
          	return tmp
          end
          
          y_m = N[Abs[y], $MachinePrecision]
          code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 6e-62], x, N[(t * z + x), $MachinePrecision]]
          
          \begin{array}{l}
          y_m = \left|y\right|
          
          \\
          \begin{array}{l}
          \mathbf{if}\;y\_m \leq 6 \cdot 10^{-62}:\\
          \;\;\;\;x\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(t, z, x\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < 6.0000000000000002e-62

            1. Initial program 93.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 inf

              \[\leadsto \color{blue}{x} \]
            4. Step-by-step derivation
              1. Simplified62.9%

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

              if 6.0000000000000002e-62 < y

              1. Initial program 80.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 y around inf

                \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
              4. Step-by-step derivation
                1. /-lowering-/.f64N/A

                  \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
                2. --lowering--.f6455.5

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

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

                \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t}{y}} \]
              7. Step-by-step derivation
                1. /-lowering-/.f6446.9

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

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

                \[\leadsto \color{blue}{x + t \cdot z} \]
              10. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \color{blue}{t \cdot z + x} \]
                2. accelerator-lowering-fma.f6452.2

                  \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, x\right)} \]
              11. Simplified52.2%

                \[\leadsto \color{blue}{\mathsf{fma}\left(t, z, x\right)} \]
            5. Recombined 2 regimes into one program.
            6. Add Preprocessing

            Alternative 9: 61.1% accurate, 239.0× speedup?

            \[\begin{array}{l} y_m = \left|y\right| \\ x \end{array} \]
            y_m = (fabs.f64 y)
            (FPCore (x y_m z t) :precision binary64 x)
            y_m = fabs(y);
            double code(double x, double y_m, double z, double t) {
            	return x;
            }
            
            y_m = abs(y)
            real(8) function code(x, y_m, z, t)
                real(8), intent (in) :: x
                real(8), intent (in) :: y_m
                real(8), intent (in) :: z
                real(8), intent (in) :: t
                code = x
            end function
            
            y_m = Math.abs(y);
            public static double code(double x, double y_m, double z, double t) {
            	return x;
            }
            
            y_m = math.fabs(y)
            def code(x, y_m, z, t):
            	return x
            
            y_m = abs(y)
            function code(x, y_m, z, t)
            	return x
            end
            
            y_m = abs(y);
            function tmp = code(x, y_m, z, t)
            	tmp = x;
            end
            
            y_m = N[Abs[y], $MachinePrecision]
            code[x_, y$95$m_, z_, t_] := x
            
            \begin{array}{l}
            y_m = \left|y\right|
            
            \\
            x
            \end{array}
            
            Derivation
            1. Initial program 89.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 inf

              \[\leadsto \color{blue}{x} \]
            4. Step-by-step derivation
              1. Simplified58.4%

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

              Developer Target 1: 96.8% 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 2024199 
              (FPCore (x y z t)
                :name "SynthBasics:moogVCF from YampaSynth-0.2"
                :precision binary64
              
                :alt
                (! :herbie-platform default (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))))
              
                (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))