SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.5% → 98.2%
Time: 14.2s
Alternatives: 12
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 12 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.5% 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.2% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 97.7%

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

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

        \[\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. fma-define98.9%

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

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

    if 3e192 < y

    1. Initial program 86.8%

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

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

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

Alternative 2: 85.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{-9} \lor \neg \left(t \leq 1.75 \cdot 10^{+27}\right):\\
\;\;\;\;x + \tanh \left(\frac{t}{y\_m}\right) \cdot \left(y\_m \cdot z\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y\_m, z \cdot \left(\frac{t}{y\_m} - \tanh \left(\frac{x}{y\_m}\right)\right), x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.20000000000000039e-9 or 1.7500000000000001e27 < t

    1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

    if -4.20000000000000039e-9 < t < 1.7500000000000001e27

    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. Step-by-step derivation
      1. +-commutative93.4%

        \[\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*96.0%

        \[\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. fma-define96.0%

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

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

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

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

Alternative 3: 96.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 6.5 \cdot 10^{+191}:\\
\;\;\;\;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{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\


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

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

    if 6.50000000000000008e191 < y

    1. Initial program 86.8%

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

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

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

Alternative 4: 84.5% accurate, 1.7× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;t \leq -4.6 \cdot 10^{-7} \lor \neg \left(t \leq 7 \cdot 10^{-36}\right):\\ \;\;\;\;x + \tanh \left(\frac{t}{y\_m}\right) \cdot \left(y\_m \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y\_m \cdot z\right) \cdot \left(\frac{t}{y\_m} - \tanh \left(\frac{x}{y\_m}\right)\right)\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
 :precision binary64
 (if (or (<= t -4.6e-7) (not (<= t 7e-36)))
   (+ x (* (tanh (/ t y_m)) (* y_m z)))
   (+ x (* (* y_m z) (- (/ t y_m) (tanh (/ x y_m)))))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
	double tmp;
	if ((t <= -4.6e-7) || !(t <= 7e-36)) {
		tmp = x + (tanh((t / y_m)) * (y_m * z));
	} else {
		tmp = x + ((y_m * z) * ((t / y_m) - tanh((x / y_m))));
	}
	return tmp;
}
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
    real(8) :: tmp
    if ((t <= (-4.6d-7)) .or. (.not. (t <= 7d-36))) then
        tmp = x + (tanh((t / y_m)) * (y_m * z))
    else
        tmp = x + ((y_m * z) * ((t / y_m) - tanh((x / y_m))))
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
	double tmp;
	if ((t <= -4.6e-7) || !(t <= 7e-36)) {
		tmp = x + (Math.tanh((t / y_m)) * (y_m * z));
	} else {
		tmp = x + ((y_m * z) * ((t / y_m) - Math.tanh((x / y_m))));
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z, t):
	tmp = 0
	if (t <= -4.6e-7) or not (t <= 7e-36):
		tmp = x + (math.tanh((t / y_m)) * (y_m * z))
	else:
		tmp = x + ((y_m * z) * ((t / y_m) - math.tanh((x / y_m))))
	return tmp
y_m = abs(y)
function code(x, y_m, z, t)
	tmp = 0.0
	if ((t <= -4.6e-7) || !(t <= 7e-36))
		tmp = Float64(x + Float64(tanh(Float64(t / y_m)) * Float64(y_m * z)));
	else
		tmp = Float64(x + Float64(Float64(y_m * z) * Float64(Float64(t / y_m) - tanh(Float64(x / y_m)))));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z, t)
	tmp = 0.0;
	if ((t <= -4.6e-7) || ~((t <= 7e-36)))
		tmp = x + (tanh((t / y_m)) * (y_m * z));
	else
		tmp = x + ((y_m * z) * ((t / y_m) - tanh((x / y_m))));
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := If[Or[LessEqual[t, -4.6e-7], N[Not[LessEqual[t, 7e-36]], $MachinePrecision]], N[(x + N[(N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] * N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y$95$m * z), $MachinePrecision] * N[(N[(t / y$95$m), $MachinePrecision] - N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{-7} \lor \neg \left(t \leq 7 \cdot 10^{-36}\right):\\
\;\;\;\;x + \tanh \left(\frac{t}{y\_m}\right) \cdot \left(y\_m \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.5999999999999999e-7 or 6.9999999999999999e-36 < t

    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 15.7%

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

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

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

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

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

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

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

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

    if -4.5999999999999999e-7 < t < 6.9999999999999999e-36

    1. Initial program 94.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 t around 0 90.4%

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

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

Alternative 5: 84.2% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 3.3 \cdot 10^{-90}:\\
\;\;\;\;x\\

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


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

    1. Initial program 98.1%

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

        \[\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*98.7%

        \[\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. fma-define98.7%

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

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

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

    if 3.3e-90 < y

    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 0 45.4%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 84.3% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 97.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 0 31.6%

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

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

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

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

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

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

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

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

    if 7.49999999999999985e184 < y

    1. Initial program 87.5%

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

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

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

Alternative 7: 67.1% accurate, 8.5× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 2.05 \cdot 10^{-10}:\\ \;\;\;\;x\\ \mathbf{elif}\;y\_m \leq 6.5 \cdot 10^{+244} \lor \neg \left(y\_m \leq 5.9 \cdot 10^{+265}\right) \land y\_m \leq 1.4 \cdot 10^{+276}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
 :precision binary64
 (if (<= y_m 2.05e-10)
   x
   (if (or (<= y_m 6.5e+244) (and (not (<= y_m 5.9e+265)) (<= y_m 1.4e+276)))
     (* x (- 1.0 z))
     (* z (- t x)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
	double tmp;
	if (y_m <= 2.05e-10) {
		tmp = x;
	} else if ((y_m <= 6.5e+244) || (!(y_m <= 5.9e+265) && (y_m <= 1.4e+276))) {
		tmp = x * (1.0 - z);
	} else {
		tmp = z * (t - x);
	}
	return tmp;
}
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
    real(8) :: tmp
    if (y_m <= 2.05d-10) then
        tmp = x
    else if ((y_m <= 6.5d+244) .or. (.not. (y_m <= 5.9d+265)) .and. (y_m <= 1.4d+276)) then
        tmp = x * (1.0d0 - z)
    else
        tmp = z * (t - x)
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
	double tmp;
	if (y_m <= 2.05e-10) {
		tmp = x;
	} else if ((y_m <= 6.5e+244) || (!(y_m <= 5.9e+265) && (y_m <= 1.4e+276))) {
		tmp = x * (1.0 - z);
	} else {
		tmp = z * (t - x);
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z, t):
	tmp = 0
	if y_m <= 2.05e-10:
		tmp = x
	elif (y_m <= 6.5e+244) or (not (y_m <= 5.9e+265) and (y_m <= 1.4e+276)):
		tmp = x * (1.0 - z)
	else:
		tmp = z * (t - x)
	return tmp
y_m = abs(y)
function code(x, y_m, z, t)
	tmp = 0.0
	if (y_m <= 2.05e-10)
		tmp = x;
	elseif ((y_m <= 6.5e+244) || (!(y_m <= 5.9e+265) && (y_m <= 1.4e+276)))
		tmp = Float64(x * Float64(1.0 - z));
	else
		tmp = Float64(z * Float64(t - x));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z, t)
	tmp = 0.0;
	if (y_m <= 2.05e-10)
		tmp = x;
	elseif ((y_m <= 6.5e+244) || (~((y_m <= 5.9e+265)) && (y_m <= 1.4e+276)))
		tmp = x * (1.0 - z);
	else
		tmp = z * (t - x);
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 2.05e-10], x, If[Or[LessEqual[y$95$m, 6.5e+244], And[N[Not[LessEqual[y$95$m, 5.9e+265]], $MachinePrecision], LessEqual[y$95$m, 1.4e+276]]], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|

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

\mathbf{elif}\;y\_m \leq 6.5 \cdot 10^{+244} \lor \neg \left(y\_m \leq 5.9 \cdot 10^{+265}\right) \land y\_m \leq 1.4 \cdot 10^{+276}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\

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


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

    1. Initial program 98.3%

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

        \[\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*98.8%

        \[\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. fma-define98.8%

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

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

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

    if 2.0499999999999999e-10 < y < 6.50000000000000011e244 or 5.9e265 < y < 1.39999999999999997e276

    1. Initial program 96.7%

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - z\right)} \]
    6. Simplified63.0%

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

    if 6.50000000000000011e244 < y < 5.9e265 or 1.39999999999999997e276 < y

    1. Initial program 74.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 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.05 \cdot 10^{-10}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+244} \lor \neg \left(y \leq 5.9 \cdot 10^{+265}\right) \land y \leq 1.4 \cdot 10^{+276}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 66.3% accurate, 10.6× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 1.8 \cdot 10^{-10}:\\ \;\;\;\;x\\ \mathbf{elif}\;y\_m \leq 7 \cdot 10^{+244} \lor \neg \left(y\_m \leq 9.2 \cdot 10^{+264}\right):\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
 :precision binary64
 (if (<= y_m 1.8e-10)
   x
   (if (or (<= y_m 7e+244) (not (<= y_m 9.2e+264))) (* x (- 1.0 z)) (* z t))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
	double tmp;
	if (y_m <= 1.8e-10) {
		tmp = x;
	} else if ((y_m <= 7e+244) || !(y_m <= 9.2e+264)) {
		tmp = x * (1.0 - z);
	} else {
		tmp = z * t;
	}
	return tmp;
}
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
    real(8) :: tmp
    if (y_m <= 1.8d-10) then
        tmp = x
    else if ((y_m <= 7d+244) .or. (.not. (y_m <= 9.2d+264))) then
        tmp = x * (1.0d0 - z)
    else
        tmp = z * t
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
	double tmp;
	if (y_m <= 1.8e-10) {
		tmp = x;
	} else if ((y_m <= 7e+244) || !(y_m <= 9.2e+264)) {
		tmp = x * (1.0 - z);
	} else {
		tmp = z * t;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z, t):
	tmp = 0
	if y_m <= 1.8e-10:
		tmp = x
	elif (y_m <= 7e+244) or not (y_m <= 9.2e+264):
		tmp = x * (1.0 - z)
	else:
		tmp = z * t
	return tmp
y_m = abs(y)
function code(x, y_m, z, t)
	tmp = 0.0
	if (y_m <= 1.8e-10)
		tmp = x;
	elseif ((y_m <= 7e+244) || !(y_m <= 9.2e+264))
		tmp = Float64(x * Float64(1.0 - z));
	else
		tmp = Float64(z * t);
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z, t)
	tmp = 0.0;
	if (y_m <= 1.8e-10)
		tmp = x;
	elseif ((y_m <= 7e+244) || ~((y_m <= 9.2e+264)))
		tmp = x * (1.0 - z);
	else
		tmp = z * t;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 1.8e-10], x, If[Or[LessEqual[y$95$m, 7e+244], N[Not[LessEqual[y$95$m, 9.2e+264]], $MachinePrecision]], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(z * t), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|

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

\mathbf{elif}\;y\_m \leq 7 \cdot 10^{+244} \lor \neg \left(y\_m \leq 9.2 \cdot 10^{+264}\right):\\
\;\;\;\;x \cdot \left(1 - z\right)\\

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


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

    1. Initial program 98.3%

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

        \[\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*98.8%

        \[\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. fma-define98.8%

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

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

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

    if 1.8e-10 < y < 6.99999999999999946e244 or 9.2000000000000005e264 < y

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - z\right)} \]
    6. Simplified59.4%

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

    if 6.99999999999999946e244 < y < 9.2000000000000005e264

    1. Initial program 72.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 100.0%

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

      \[\leadsto \color{blue}{t \cdot z} \]
    5. Step-by-step derivation
      1. *-commutative89.9%

        \[\leadsto \color{blue}{z \cdot t} \]
    6. Simplified89.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.8 \cdot 10^{-10}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+244} \lor \neg \left(y \leq 9.2 \cdot 10^{+264}\right):\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 69.2% accurate, 10.6× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 3.9 \cdot 10^{-10}:\\ \;\;\;\;x\\ \mathbf{elif}\;y\_m \leq 6 \cdot 10^{+94}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{elif}\;y\_m \leq 6.5 \cdot 10^{+276}:\\ \;\;\;\;x + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
 :precision binary64
 (if (<= y_m 3.9e-10)
   x
   (if (<= y_m 6e+94)
     (* x (- 1.0 z))
     (if (<= y_m 6.5e+276) (+ x (* z t)) (* z (- t x))))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
	double tmp;
	if (y_m <= 3.9e-10) {
		tmp = x;
	} else if (y_m <= 6e+94) {
		tmp = x * (1.0 - z);
	} else if (y_m <= 6.5e+276) {
		tmp = x + (z * t);
	} else {
		tmp = z * (t - x);
	}
	return tmp;
}
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
    real(8) :: tmp
    if (y_m <= 3.9d-10) then
        tmp = x
    else if (y_m <= 6d+94) then
        tmp = x * (1.0d0 - z)
    else if (y_m <= 6.5d+276) then
        tmp = x + (z * t)
    else
        tmp = z * (t - x)
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
	double tmp;
	if (y_m <= 3.9e-10) {
		tmp = x;
	} else if (y_m <= 6e+94) {
		tmp = x * (1.0 - z);
	} else if (y_m <= 6.5e+276) {
		tmp = x + (z * t);
	} else {
		tmp = z * (t - x);
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z, t):
	tmp = 0
	if y_m <= 3.9e-10:
		tmp = x
	elif y_m <= 6e+94:
		tmp = x * (1.0 - z)
	elif y_m <= 6.5e+276:
		tmp = x + (z * t)
	else:
		tmp = z * (t - x)
	return tmp
y_m = abs(y)
function code(x, y_m, z, t)
	tmp = 0.0
	if (y_m <= 3.9e-10)
		tmp = x;
	elseif (y_m <= 6e+94)
		tmp = Float64(x * Float64(1.0 - z));
	elseif (y_m <= 6.5e+276)
		tmp = Float64(x + Float64(z * t));
	else
		tmp = Float64(z * Float64(t - x));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z, t)
	tmp = 0.0;
	if (y_m <= 3.9e-10)
		tmp = x;
	elseif (y_m <= 6e+94)
		tmp = x * (1.0 - z);
	elseif (y_m <= 6.5e+276)
		tmp = x + (z * t);
	else
		tmp = z * (t - x);
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 3.9e-10], x, If[LessEqual[y$95$m, 6e+94], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 6.5e+276], N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|

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

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

\mathbf{elif}\;y\_m \leq 6.5 \cdot 10^{+276}:\\
\;\;\;\;x + z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 3.9e-10

    1. Initial program 98.3%

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

        \[\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*98.8%

        \[\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. fma-define98.8%

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

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

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

    if 3.9e-10 < y < 6.0000000000000001e94

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - z\right)} \]
    6. Simplified65.9%

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

    if 6.0000000000000001e94 < y < 6.49999999999999972e276

    1. Initial program 91.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot t} + x \]
    8. Simplified80.8%

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

    if 6.49999999999999972e276 < y

    1. Initial program 74.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 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.9 \cdot 10^{-10}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6 \cdot 10^{+94}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+276}:\\ \;\;\;\;x + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 77.3% accurate, 17.7× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 7.8 \cdot 10^{+71}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
 :precision binary64
 (if (<= y_m 7.8e+71) x (+ x (* z (- t x)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
	double tmp;
	if (y_m <= 7.8e+71) {
		tmp = x;
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
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
    real(8) :: tmp
    if (y_m <= 7.8d+71) then
        tmp = x
    else
        tmp = x + (z * (t - x))
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
	double tmp;
	if (y_m <= 7.8e+71) {
		tmp = x;
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z, t):
	tmp = 0
	if y_m <= 7.8e+71:
		tmp = x
	else:
		tmp = x + (z * (t - x))
	return tmp
y_m = abs(y)
function code(x, y_m, z, t)
	tmp = 0.0
	if (y_m <= 7.8e+71)
		tmp = x;
	else
		tmp = Float64(x + Float64(z * Float64(t - x)));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z, t)
	tmp = 0.0;
	if (y_m <= 7.8e+71)
		tmp = x;
	else
		tmp = x + (z * (t - x));
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 7.8e+71], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 7.8 \cdot 10^{+71}:\\
\;\;\;\;x\\

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


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

    1. Initial program 98.4%

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

        \[\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*98.9%

        \[\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. fma-define98.9%

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

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

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

    if 7.8000000000000002e71 < y

    1. Initial program 89.9%

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

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

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

Alternative 11: 59.8% accurate, 26.6× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 6.5 \cdot 10^{+244}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m z t) :precision binary64 (if (<= y_m 6.5e+244) x (* z t)))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
	double tmp;
	if (y_m <= 6.5e+244) {
		tmp = x;
	} else {
		tmp = z * t;
	}
	return tmp;
}
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
    real(8) :: tmp
    if (y_m <= 6.5d+244) then
        tmp = x
    else
        tmp = z * t
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
	double tmp;
	if (y_m <= 6.5e+244) {
		tmp = x;
	} else {
		tmp = z * t;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z, t):
	tmp = 0
	if y_m <= 6.5e+244:
		tmp = x
	else:
		tmp = z * t
	return tmp
y_m = abs(y)
function code(x, y_m, z, t)
	tmp = 0.0
	if (y_m <= 6.5e+244)
		tmp = x;
	else
		tmp = Float64(z * t);
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m, z, t)
	tmp = 0.0;
	if (y_m <= 6.5e+244)
		tmp = x;
	else
		tmp = z * t;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 6.5e+244], x, N[(z * t), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 6.5 \cdot 10^{+244}:\\
\;\;\;\;x\\

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


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

    1. Initial program 97.8%

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

        \[\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*98.3%

        \[\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. fma-define98.3%

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

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

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

    if 6.50000000000000011e244 < y

    1. Initial program 79.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 100.0%

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

      \[\leadsto \color{blue}{t \cdot z} \]
    5. Step-by-step derivation
      1. *-commutative67.7%

        \[\leadsto \color{blue}{z \cdot t} \]
    6. Simplified67.7%

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

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

Alternative 12: 59.7% accurate, 213.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 96.1%

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

      \[\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*96.3%

      \[\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. fma-define96.3%

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

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

    \[\leadsto \color{blue}{x} \]
  6. Final simplification61.9%

    \[\leadsto x \]
  7. Add Preprocessing

Developer target: 97.0% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2024067 
(FPCore (x y z t)
  :name "SynthBasics:moogVCF from YampaSynth-0.2"
  :precision binary64

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

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