SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.3% → 96.6%
Time: 10.9s
Alternatives: 8
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 8 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.3% 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: 96.6% accurate, 1.0× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 5.2 \cdot 10^{+149}:\\ \;\;\;\;\mathsf{fma}\left(\tanh \left(\frac{t}{y\_m}\right) - \tanh \left(\frac{x}{y\_m}\right), y\_m \cdot 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 5.2e+149)
   (fma (- (tanh (/ t 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 <= 5.2e+149) {
		tmp = fma((tanh((t / 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 <= 5.2e+149)
		tmp = fma(Float64(tanh(Float64(t / y_m)) - 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, 5.2e+149], 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] + 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 5.2 \cdot 10^{+149}:\\
\;\;\;\;\mathsf{fma}\left(\tanh \left(\frac{t}{y\_m}\right) - \tanh \left(\frac{x}{y\_m}\right), y\_m \cdot 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 < 5.19999999999999957e149

    1. Initial program 95.4%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. 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. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

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

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

    if 5.19999999999999957e149 < y

    1. Initial program 71.1%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in 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--.f6490.0

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

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

Alternative 2: 71.2% 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 5 \cdot 10^{+297}:\\ \;\;\;\;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 5e+297) 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 <= 5e+297) {
		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 <= 5e+297) {
		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 <= 5e+297:
		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 <= 5e+297)
		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 <= 5e+297)
		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, 5e+297], 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 5 \cdot 10^{+297}:\\
\;\;\;\;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 4.9999999999999998e297 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

    1. Initial program 58.9%

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

      \[\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--.f6497.5

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

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

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

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

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

      \[\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))))) < 4.9999999999999998e297

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

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

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

      \[\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 5 \cdot 10^{+297}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \end{array} \]
    7. Add Preprocessing

    Alternative 3: 65.4% accurate, 0.5× speedup?

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

      1. Initial program 58.9%

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

        \[\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--.f6497.5

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

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

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

          \[\leadsto \color{blue}{z \cdot t} \]
        2. *-lowering-*.f6453.6

          \[\leadsto \color{blue}{z \cdot t} \]
      8. Simplified53.6%

        \[\leadsto \color{blue}{z \cdot t} \]

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

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

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

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

        \[\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:\\ \;\;\;\;t \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 5 \cdot 10^{+297}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \]
      7. Add Preprocessing

      Alternative 4: 81.6% accurate, 1.6× speedup?

      \[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 7.2 \cdot 10^{-11}:\\ \;\;\;\;x\\ \mathbf{elif}\;y\_m \leq 7.5 \cdot 10^{+148}:\\ \;\;\;\;\mathsf{fma}\left(\tanh \left(\frac{t}{y\_m}\right) - \frac{x}{y\_m}, y\_m \cdot 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 7.2e-11)
         x
         (if (<= y_m 7.5e+148)
           (fma (- (tanh (/ t y_m)) (/ 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 <= 7.2e-11) {
      		tmp = x;
      	} else if (y_m <= 7.5e+148) {
      		tmp = fma((tanh((t / y_m)) - (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 <= 7.2e-11)
      		tmp = x;
      	elseif (y_m <= 7.5e+148)
      		tmp = fma(Float64(tanh(Float64(t / y_m)) - 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, 7.2e-11], x, If[LessEqual[y$95$m, 7.5e+148], N[(N[(N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] - N[(x / y$95$m), $MachinePrecision]), $MachinePrecision] * N[(y$95$m * z), $MachinePrecision] + 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 7.2 \cdot 10^{-11}:\\
      \;\;\;\;x\\
      
      \mathbf{elif}\;y\_m \leq 7.5 \cdot 10^{+148}:\\
      \;\;\;\;\mathsf{fma}\left(\tanh \left(\frac{t}{y\_m}\right) - \frac{x}{y\_m}, y\_m \cdot z, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if y < 7.19999999999999969e-11

        1. Initial program 95.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. Simplified65.5%

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

          if 7.19999999999999969e-11 < y < 7.50000000000000008e148

          1. Initial program 94.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 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-/.f6472.2

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

            \[\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. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

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

          if 7.50000000000000008e148 < y

          1. Initial program 71.1%

            \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
          2. Add Preprocessing
          3. Taylor expanded in 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--.f6490.0

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

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

        Alternative 5: 82.1% accurate, 1.7× speedup?

        \[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 7.8 \cdot 10^{-115}:\\ \;\;\;\;x\\ \mathbf{elif}\;y\_m \leq 1.3 \cdot 10^{+147}:\\ \;\;\;\;\mathsf{fma}\left(z, -x, \mathsf{fma}\left(y\_m \cdot z, \tanh \left(\frac{t}{y\_m}\right), x\right)\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 7.8e-115)
           x
           (if (<= y_m 1.3e+147)
             (fma z (- x) (fma (* y_m z) (tanh (/ t 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 <= 7.8e-115) {
        		tmp = x;
        	} else if (y_m <= 1.3e+147) {
        		tmp = fma(z, -x, fma((y_m * z), tanh((t / 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 <= 7.8e-115)
        		tmp = x;
        	elseif (y_m <= 1.3e+147)
        		tmp = fma(z, Float64(-x), fma(Float64(y_m * z), tanh(Float64(t / 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, 7.8e-115], x, If[LessEqual[y$95$m, 1.3e+147], N[(z * (-x) + N[(N[(y$95$m * z), $MachinePrecision] * N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] + x), $MachinePrecision]), $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 7.8 \cdot 10^{-115}:\\
        \;\;\;\;x\\
        
        \mathbf{elif}\;y\_m \leq 1.3 \cdot 10^{+147}:\\
        \;\;\;\;\mathsf{fma}\left(z, -x, \mathsf{fma}\left(y\_m \cdot z, \tanh \left(\frac{t}{y\_m}\right), x\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if y < 7.7999999999999997e-115

          1. Initial program 94.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. Simplified64.4%

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

            if 7.7999999999999997e-115 < y < 1.2999999999999999e147

            1. Initial program 97.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-/.f6474.1

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

              \[\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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{y}\right) + \left(\left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right) + x\right)} \]
              4. un-div-invN/A

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(z \cdot \frac{1}{y}\right)} \cdot y, \mathsf{neg}\left(x\right), \left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right) + x\right) \]
              12. associate-*l*N/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{z \cdot \left(\frac{1}{y} \cdot y\right)}, \mathsf{neg}\left(x\right), \left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right) + x\right) \]
              13. inv-powN/A

                \[\leadsto \mathsf{fma}\left(z \cdot \left(\color{blue}{{y}^{-1}} \cdot y\right), \mathsf{neg}\left(x\right), \left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right) + x\right) \]
              14. pow-plusN/A

                \[\leadsto \mathsf{fma}\left(z \cdot \color{blue}{{y}^{\left(-1 + 1\right)}}, \mathsf{neg}\left(x\right), \left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right) + x\right) \]
              15. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(z \cdot {y}^{\color{blue}{0}}, \mathsf{neg}\left(x\right), \left(y \cdot z\right) \cdot \tanh \left(\frac{t}{y}\right) + x\right) \]
              16. metadata-evalN/A

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

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

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

                \[\leadsto \mathsf{fma}\left(z \cdot 1, \mathsf{neg}\left(x\right), \color{blue}{\mathsf{fma}\left(y \cdot z, \tanh \left(\frac{t}{y}\right), x\right)}\right) \]
            9. Applied egg-rr75.5%

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

            if 1.2999999999999999e147 < y

            1. Initial program 71.1%

              \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
            2. Add Preprocessing
            3. Taylor expanded in 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--.f6490.0

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

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

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

          Alternative 6: 77.9% accurate, 14.9× speedup?

          \[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 1.1 \cdot 10^{+39}:\\ \;\;\;\;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 1.1e+39) 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.1e+39) {
          		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 <= 1.1e+39)
          		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, 1.1e+39], 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 1.1 \cdot 10^{+39}:\\
          \;\;\;\;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 < 1.1000000000000001e39

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

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

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

              if 1.1000000000000001e39 < y

              1. Initial program 80.6%

                \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
              2. Add Preprocessing
              3. Taylor expanded in 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--.f6477.5

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

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

            Alternative 7: 70.7% accurate, 18.4× speedup?

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

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

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

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

                if 6.20000000000000035e38 < y

                1. Initial program 80.6%

                  \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
                2. Add Preprocessing
                3. Taylor expanded in 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--.f6477.5

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

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

                  \[\leadsto \mathsf{fma}\left(z, \color{blue}{t}, x\right) \]
                7. Step-by-step derivation
                  1. Simplified69.9%

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

                Alternative 8: 59.9% 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 92.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 x around inf

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

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

                  Developer Target 1: 97.1% 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 2024204 
                  (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))))))