SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.4% → 98.5%
Time: 12.3s
Alternatives: 13
Speedup: 0.7×

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 13 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.4% 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.5% accurate, 0.7× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 5 \cdot 10^{+216}:\\ \;\;\;\;\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 5e+216)
   (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 <= 5e+216) {
		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 <= 5e+216)
		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, 5e+216], 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 5 \cdot 10^{+216}:\\
\;\;\;\;\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 < 4.9999999999999998e216

    1. Initial program 95.6%

      \[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. +-commutative95.6%

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

    if 4.9999999999999998e216 < y

    1. Initial program 51.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)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 5 \cdot 10^{+216}:\\ \;\;\;\;\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: 95.7% 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 2 \cdot 10^{+289}:\\ \;\;\;\;t\_1\\ \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
 (let* ((t_1 (+ x (* (- (tanh (/ t y_m)) (tanh (/ x y_m))) (* y_m z)))))
   (if (<= t_1 2e+289) t_1 (* z (- t x)))))
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 <= 2e+289) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_1 = x + ((tanh((t / y_m)) - tanh((x / y_m))) * (y_m * z))
    if (t_1 <= 2d+289) then
        tmp = t_1
    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 t_1 = x + ((Math.tanh((t / y_m)) - Math.tanh((x / y_m))) * (y_m * z));
	double tmp;
	if (t_1 <= 2e+289) {
		tmp = t_1;
	} else {
		tmp = z * (t - x);
	}
	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 <= 2e+289:
		tmp = t_1
	else:
		tmp = z * (t - x)
	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 <= 2e+289)
		tmp = t_1;
	else
		tmp = Float64(z * Float64(t - x));
	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 <= 2e+289)
		tmp = t_1;
	else
		tmp = z * (t - x);
	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, 2e+289], t$95$1, N[(z * N[(t - x), $MachinePrecision]), $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 2 \cdot 10^{+289}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 2.0000000000000001e289

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

    if 2.0000000000000001e289 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

    1. Initial program 36.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 95.0%

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

      \[\leadsto \color{blue}{z \cdot \left(t - x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.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 2 \cdot 10^{+289}:\\ \;\;\;\;x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 76.1% accurate, 1.8× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 6.2 \cdot 10^{-36}:\\ \;\;\;\;x\\ \mathbf{elif}\;y\_m \leq 0.00125:\\ \;\;\;\;z \cdot \left(y\_m \cdot \tanh \left(\frac{t}{y\_m}\right) - x\right)\\ \mathbf{elif}\;y\_m \leq 1.15 \cdot 10^{+75}:\\ \;\;\;\;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 6.2e-36)
   x
   (if (<= y_m 0.00125)
     (* z (- (* y_m (tanh (/ t y_m))) x))
     (if (<= y_m 1.15e+75) 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 <= 6.2e-36) {
		tmp = x;
	} else if (y_m <= 0.00125) {
		tmp = z * ((y_m * tanh((t / y_m))) - x);
	} else if (y_m <= 1.15e+75) {
		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 <= 6.2e-36)
		tmp = x;
	elseif (y_m <= 0.00125)
		tmp = Float64(z * Float64(Float64(y_m * tanh(Float64(t / y_m))) - x));
	elseif (y_m <= 1.15e+75)
		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, 6.2e-36], x, If[LessEqual[y$95$m, 0.00125], N[(z * N[(N[(y$95$m * N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 1.15e+75], 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 6.2 \cdot 10^{-36}:\\
\;\;\;\;x\\

\mathbf{elif}\;y\_m \leq 0.00125:\\
\;\;\;\;z \cdot \left(y\_m \cdot \tanh \left(\frac{t}{y\_m}\right) - x\right)\\

\mathbf{elif}\;y\_m \leq 1.15 \cdot 10^{+75}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 6.1999999999999997e-36 or 0.00125000000000000003 < y < 1.1499999999999999e75

    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. Add Preprocessing
    3. Taylor expanded in x around inf 66.0%

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

    if 6.1999999999999997e-36 < y < 0.00125000000000000003

    1. Initial program 99.5%

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

      \[\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. +-commutative35.7%

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

      \[\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 inf 25.0%

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

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

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

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

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

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

    if 1.1499999999999999e75 < y

    1. Initial program 80.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 84.7%

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

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. fma-define84.8%

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

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

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

Alternative 4: 82.0% accurate, 1.8× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;t \leq -1.75 \cdot 10^{-90} \lor \neg \left(t \leq 3.8 \cdot 10^{-34}\right):\\ \;\;\;\;x + y\_m \cdot \left(z \cdot \tanh \left(\frac{t}{y\_m}\right)\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 (or (<= t -1.75e-90) (not (<= t 3.8e-34)))
   (+ x (* y_m (* z (tanh (/ t y_m)))))
   (+ x (* z (- t x)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
	double tmp;
	if ((t <= -1.75e-90) || !(t <= 3.8e-34)) {
		tmp = x + (y_m * (z * tanh((t / y_m))));
	} 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 ((t <= (-1.75d-90)) .or. (.not. (t <= 3.8d-34))) then
        tmp = x + (y_m * (z * tanh((t / y_m))))
    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 ((t <= -1.75e-90) || !(t <= 3.8e-34)) {
		tmp = x + (y_m * (z * Math.tanh((t / y_m))));
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m, z, t):
	tmp = 0
	if (t <= -1.75e-90) or not (t <= 3.8e-34):
		tmp = x + (y_m * (z * math.tanh((t / y_m))))
	else:
		tmp = x + (z * (t - x))
	return tmp
y_m = abs(y)
function code(x, y_m, z, t)
	tmp = 0.0
	if ((t <= -1.75e-90) || !(t <= 3.8e-34))
		tmp = Float64(x + Float64(y_m * Float64(z * tanh(Float64(t / y_m)))));
	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 ((t <= -1.75e-90) || ~((t <= 3.8e-34)))
		tmp = x + (y_m * (z * tanh((t / y_m))));
	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[Or[LessEqual[t, -1.75e-90], N[Not[LessEqual[t, 3.8e-34]], $MachinePrecision]], N[(x + N[(y$95$m * N[(z * N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision]), $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}\;t \leq -1.75 \cdot 10^{-90} \lor \neg \left(t \leq 3.8 \cdot 10^{-34}\right):\\
\;\;\;\;x + y\_m \cdot \left(z \cdot \tanh \left(\frac{t}{y\_m}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.7499999999999999e-90 or 3.8000000000000001e-34 < t

    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. Add Preprocessing
    3. Taylor expanded in x around 0 7.5%

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

        \[\leadsto x + y \cdot \left(z \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)\right) \]
      2. div-sub7.5%

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

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

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

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

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

    if -1.7499999999999999e-90 < t < 3.8000000000000001e-34

    1. Initial program 85.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 81.8%

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

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

Alternative 5: 87.1% accurate, 1.8× speedup?

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

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

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


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

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

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

        \[\leadsto x + y \cdot \left(z \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)\right) \]
      2. div-sub17.1%

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

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

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

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

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

    if 1.74999999999999999e-43 < y

    1. Initial program 85.9%

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

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

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

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

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

Alternative 6: 77.4% accurate, 1.9× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 1.2 \cdot 10^{+75}:\\ \;\;\;\;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.2e+75) 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.2e+75) {
		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.2e+75)
		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.2e+75], 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.2 \cdot 10^{+75}:\\
\;\;\;\;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.2e75

    1. Initial program 96.2%

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

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

    if 1.2e75 < y

    1. Initial program 80.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 84.7%

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

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. fma-define84.8%

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

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

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

Alternative 7: 66.6% accurate, 10.6× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 2.2 \cdot 10^{+28}:\\ \;\;\;\;x\\ \mathbf{elif}\;y\_m \leq 8.8 \cdot 10^{+219} \lor \neg \left(y\_m \leq 7.6 \cdot 10^{+236}\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 2.2e+28)
   x
   (if (or (<= y_m 8.8e+219) (not (<= y_m 7.6e+236)))
     (* 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 <= 2.2e+28) {
		tmp = x;
	} else if ((y_m <= 8.8e+219) || !(y_m <= 7.6e+236)) {
		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 <= 2.2d+28) then
        tmp = x
    else if ((y_m <= 8.8d+219) .or. (.not. (y_m <= 7.6d+236))) 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 <= 2.2e+28) {
		tmp = x;
	} else if ((y_m <= 8.8e+219) || !(y_m <= 7.6e+236)) {
		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 <= 2.2e+28:
		tmp = x
	elif (y_m <= 8.8e+219) or not (y_m <= 7.6e+236):
		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 <= 2.2e+28)
		tmp = x;
	elseif ((y_m <= 8.8e+219) || !(y_m <= 7.6e+236))
		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 <= 2.2e+28)
		tmp = x;
	elseif ((y_m <= 8.8e+219) || ~((y_m <= 7.6e+236)))
		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, 2.2e+28], x, If[Or[LessEqual[y$95$m, 8.8e+219], N[Not[LessEqual[y$95$m, 7.6e+236]], $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 2.2 \cdot 10^{+28}:\\
\;\;\;\;x\\

\mathbf{elif}\;y\_m \leq 8.8 \cdot 10^{+219} \lor \neg \left(y\_m \leq 7.6 \cdot 10^{+236}\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 < 2.19999999999999986e28

    1. Initial program 96.0%

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

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

    if 2.19999999999999986e28 < y < 8.8000000000000006e219 or 7.59999999999999973e236 < y

    1. Initial program 82.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 52.9%

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

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

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

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

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

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

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

    if 8.8000000000000006e219 < y < 7.59999999999999973e236

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.2 \cdot 10^{+28}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 8.8 \cdot 10^{+219} \lor \neg \left(y \leq 7.6 \cdot 10^{+236}\right):\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 66.6% accurate, 14.2× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 2.6 \cdot 10^{+28}:\\ \;\;\;\;x\\ \mathbf{elif}\;y\_m \leq 1.85 \cdot 10^{+197}:\\ \;\;\;\;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.6e+28) x (if (<= y_m 1.85e+197) (* 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.6e+28) {
		tmp = x;
	} else if (y_m <= 1.85e+197) {
		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.6d+28) then
        tmp = x
    else if (y_m <= 1.85d+197) 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.6e+28) {
		tmp = x;
	} else if (y_m <= 1.85e+197) {
		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.6e+28:
		tmp = x
	elif y_m <= 1.85e+197:
		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.6e+28)
		tmp = x;
	elseif (y_m <= 1.85e+197)
		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.6e+28)
		tmp = x;
	elseif (y_m <= 1.85e+197)
		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.6e+28], x, If[LessEqual[y$95$m, 1.85e+197], 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.6 \cdot 10^{+28}:\\
\;\;\;\;x\\

\mathbf{elif}\;y\_m \leq 1.85 \cdot 10^{+197}:\\
\;\;\;\;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.6000000000000002e28

    1. Initial program 96.0%

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

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

    if 2.6000000000000002e28 < y < 1.8500000000000002e197

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

      \[\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. +-commutative47.0%

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

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

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

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

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

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

    if 1.8500000000000002e197 < y

    1. Initial program 56.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 95.1%

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

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

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

Alternative 9: 68.3% accurate, 14.2× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 4 \cdot 10^{+75}:\\ \;\;\;\;x\\ \mathbf{elif}\;y\_m \leq 1.85 \cdot 10^{+198}:\\ \;\;\;\;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 4e+75) x (if (<= y_m 1.85e+198) (+ 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 <= 4e+75) {
		tmp = x;
	} else if (y_m <= 1.85e+198) {
		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 <= 4d+75) then
        tmp = x
    else if (y_m <= 1.85d+198) 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 <= 4e+75) {
		tmp = x;
	} else if (y_m <= 1.85e+198) {
		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 <= 4e+75:
		tmp = x
	elif y_m <= 1.85e+198:
		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 <= 4e+75)
		tmp = x;
	elseif (y_m <= 1.85e+198)
		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 <= 4e+75)
		tmp = x;
	elseif (y_m <= 1.85e+198)
		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, 4e+75], x, If[LessEqual[y$95$m, 1.85e+198], 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 4 \cdot 10^{+75}:\\
\;\;\;\;x\\

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

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


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

    1. Initial program 96.2%

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

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

    if 3.99999999999999971e75 < y < 1.8499999999999999e198

    1. Initial program 93.9%

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

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

        \[\leadsto x + y \cdot \left(z \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)\right) \]
      2. div-sub33.5%

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

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

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

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

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

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

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

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

    if 1.8499999999999999e198 < y

    1. Initial program 56.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 95.1%

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

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

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

Alternative 10: 58.8% accurate, 15.2× speedup?

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

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

\mathbf{elif}\;y\_m \leq 2.1 \cdot 10^{+241}:\\
\;\;\;\;z \cdot t\\

\mathbf{else}:\\
\;\;\;\;-z \cdot x\\


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

    1. Initial program 95.9%

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

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

    if 5.20000000000000024e196 < y < 2.1e241

    1. Initial program 87.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 88.9%

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

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

    if 2.1e241 < y

    1. Initial program 31.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 71.5%

      \[\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. +-commutative71.5%

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

      \[\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 inf 52.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-x \cdot z} \]
      2. distribute-lft-neg-out52.5%

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

        \[\leadsto \color{blue}{z \cdot \left(-x\right)} \]
    11. Simplified52.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 5.2 \cdot 10^{+196}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{+241}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;-z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 77.4% accurate, 17.7× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 1.2 \cdot 10^{+75}:\\ \;\;\;\;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 1.2e+75) 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 <= 1.2e+75) {
		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 <= 1.2d+75) 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 <= 1.2e+75) {
		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 <= 1.2e+75:
		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 <= 1.2e+75)
		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 <= 1.2e+75)
		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, 1.2e+75], 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 1.2 \cdot 10^{+75}:\\
\;\;\;\;x\\

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


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

    1. Initial program 96.2%

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

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

    if 1.2e75 < y

    1. Initial program 80.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 84.7%

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

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

Alternative 12: 59.7% accurate, 26.6× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;y\_m \leq 9.5 \cdot 10^{+198}:\\ \;\;\;\;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 9.5e+198) x (* z t)))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
	double tmp;
	if (y_m <= 9.5e+198) {
		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 <= 9.5d+198) 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 <= 9.5e+198) {
		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 <= 9.5e+198:
		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 <= 9.5e+198)
		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 <= 9.5e+198)
		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, 9.5e+198], x, N[(z * t), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

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

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


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

    1. Initial program 95.9%

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

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

    if 9.5e198 < y

    1. Initial program 56.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 95.1%

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

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

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

Alternative 13: 60.3% 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 93.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 inf 59.7%

    \[\leadsto \color{blue}{x} \]
  4. Final simplification59.7%

    \[\leadsto x \]
  5. Add Preprocessing

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

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

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