SynthBasics:moogVCF from YampaSynth-0.2

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

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

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

Alternative 1: 98.4% accurate, 0.7× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 9.5 \cdot 10^{+191}:\\ \;\;\;\;\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= y 9.5e+191)
   (fma (* y (- (tanh (/ t y)) (tanh (/ x y)))) z x)
   (fma z (- t x) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 9.5e+191) {
		tmp = fma((y * (tanh((t / y)) - tanh((x / y)))), z, x);
	} else {
		tmp = fma(z, (t - x), x);
	}
	return tmp;
}
y = abs(y)
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 9.5e+191)
		tmp = fma(Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), z, x);
	else
		tmp = fma(z, Float64(t - x), x);
	end
	return tmp
end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[y, 9.5e+191], N[(N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.5 \cdot 10^{+191}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), z, x\right)\\

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


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

    1. Initial program 92.3%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Step-by-step derivation
      1. +-commutative92.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. *-commutative92.3%

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

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

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

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

    if 9.4999999999999998e191 < y

    1. Initial program 70.1%

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

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

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

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

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

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

Alternative 2: 97.0% accurate, 1.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.85 \cdot 10^{+187}:\\ \;\;\;\;x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= y 1.85e+187)
   (+ x (* (- (tanh (/ t y)) (tanh (/ x y))) (* y z)))
   (fma z (- t x) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 1.85e+187) {
		tmp = x + ((tanh((t / y)) - tanh((x / y))) * (y * z));
	} else {
		tmp = fma(z, (t - x), x);
	}
	return tmp;
}
y = abs(y)
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 1.85e+187)
		tmp = Float64(x + Float64(Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))) * Float64(y * z)));
	else
		tmp = fma(z, Float64(t - x), x);
	end
	return tmp
end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[y, 1.85e+187], N[(x + N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.85 \cdot 10^{+187}:\\
\;\;\;\;x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\

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


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

    1. Initial program 92.3%

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

    if 1.85000000000000009e187 < y

    1. Initial program 70.1%

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

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

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

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

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

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

Alternative 3: 87.3% accurate, 1.8× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -4 \cdot 10^{-96} \lor \neg \left(t \leq 3.8 \cdot 10^{+36}\right):\\ \;\;\;\;x + y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - y \cdot \tanh \left(\frac{x}{y}\right)\right)\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (or (<= t -4e-96) (not (<= t 3.8e+36)))
   (+ x (* y (* (tanh (/ t y)) z)))
   (+ x (* z (- t (* y (tanh (/ x y))))))))
y = abs(y);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -4e-96) || !(t <= 3.8e+36)) {
		tmp = x + (y * (tanh((t / y)) * z));
	} else {
		tmp = x + (z * (t - (y * tanh((x / y)))));
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((t <= (-4d-96)) .or. (.not. (t <= 3.8d+36))) then
        tmp = x + (y * (tanh((t / y)) * z))
    else
        tmp = x + (z * (t - (y * tanh((x / y)))))
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -4e-96) || !(t <= 3.8e+36)) {
		tmp = x + (y * (Math.tanh((t / y)) * z));
	} else {
		tmp = x + (z * (t - (y * Math.tanh((x / y)))));
	}
	return tmp;
}
y = abs(y)
def code(x, y, z, t):
	tmp = 0
	if (t <= -4e-96) or not (t <= 3.8e+36):
		tmp = x + (y * (math.tanh((t / y)) * z))
	else:
		tmp = x + (z * (t - (y * math.tanh((x / y)))))
	return tmp
y = abs(y)
function code(x, y, z, t)
	tmp = 0.0
	if ((t <= -4e-96) || !(t <= 3.8e+36))
		tmp = Float64(x + Float64(y * Float64(tanh(Float64(t / y)) * z)));
	else
		tmp = Float64(x + Float64(z * Float64(t - Float64(y * tanh(Float64(x / y))))));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((t <= -4e-96) || ~((t <= 3.8e+36)))
		tmp = x + (y * (tanh((t / y)) * z));
	else
		tmp = x + (z * (t - (y * tanh((x / y)))));
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4e-96], N[Not[LessEqual[t, 3.8e+36]], $MachinePrecision]], N[(x + N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - N[(y * N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{-96} \lor \neg \left(t \leq 3.8 \cdot 10^{+36}\right):\\
\;\;\;\;x + y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.9999999999999996e-96 or 3.80000000000000025e36 < t

    1. Initial program 94.3%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Taylor expanded in x around 0 13.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)} \]
    3. Step-by-step derivation
      1. associate-/r*13.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-sub13.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-exp13.2%

        \[\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-exp13.2%

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

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

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

    if -3.9999999999999996e-96 < t < 3.80000000000000025e36

    1. Initial program 85.1%

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

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

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

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

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

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

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

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

      \[\leadsto x + \color{blue}{z \cdot \left(t - y \cdot \left(\frac{e^{\frac{x}{y}}}{e^{\frac{x}{y}} + \frac{1}{e^{\frac{x}{y}}}} - \frac{1}{e^{\frac{x}{y}} \cdot \left(e^{\frac{x}{y}} + \frac{1}{e^{\frac{x}{y}}}\right)}\right)\right)} \]
    7. Step-by-step derivation
      1. cancel-sign-sub-inv37.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4 \cdot 10^{-96} \lor \neg \left(t \leq 3.8 \cdot 10^{+36}\right):\\ \;\;\;\;x + y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - y \cdot \tanh \left(\frac{x}{y}\right)\right)\\ \end{array} \]

Alternative 4: 85.2% accurate, 1.9× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 3.5 \cdot 10^{+136}:\\ \;\;\;\;x + y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= y 3.5e+136) (+ x (* y (* (tanh (/ t y)) z))) (fma z (- t x) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 3.5e+136) {
		tmp = x + (y * (tanh((t / y)) * z));
	} else {
		tmp = fma(z, (t - x), x);
	}
	return tmp;
}
y = abs(y)
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 3.5e+136)
		tmp = Float64(x + Float64(y * Float64(tanh(Float64(t / y)) * z)));
	else
		tmp = fma(z, Float64(t - x), x);
	end
	return tmp
end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[y, 3.5e+136], N[(x + N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.5 \cdot 10^{+136}:\\
\;\;\;\;x + y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z\right)\\

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


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

    1. Initial program 92.5%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Taylor expanded in x around 0 25.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)} \]
    3. Step-by-step derivation
      1. associate-/r*25.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-sub25.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-exp25.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-exp25.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-a78.9%

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

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

    if 3.50000000000000001e136 < y

    1. Initial program 72.7%

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

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

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

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

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

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

Alternative 5: 76.8% accurate, 2.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 2.1 \cdot 10^{-49}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z t) :precision binary64 (if (<= y 2.1e-49) x (fma z (- t x) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.1e-49) {
		tmp = x;
	} else {
		tmp = fma(z, (t - x), x);
	}
	return tmp;
}
y = abs(y)
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 2.1e-49)
		tmp = x;
	else
		tmp = fma(z, Float64(t - x), x);
	end
	return tmp
end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[y, 2.1e-49], x, N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.1 \cdot 10^{-49}:\\
\;\;\;\;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 < 2.0999999999999999e-49

    1. Initial program 93.2%

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

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

    if 2.0999999999999999e-49 < y

    1. Initial program 81.2%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.1 \cdot 10^{-49}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\ \end{array} \]

Alternative 6: 64.5% accurate, 19.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 2.2 \cdot 10^{+14}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+206} \lor \neg \left(y \leq 1.42 \cdot 10^{+251}\right):\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= y 2.2e+14)
   x
   (if (or (<= y 1.2e+206) (not (<= y 1.42e+251))) (* x (- 1.0 z)) (* t z))))
y = abs(y);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.2e+14) {
		tmp = x;
	} else if ((y <= 1.2e+206) || !(y <= 1.42e+251)) {
		tmp = x * (1.0 - z);
	} else {
		tmp = t * z;
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= 2.2d+14) then
        tmp = x
    else if ((y <= 1.2d+206) .or. (.not. (y <= 1.42d+251))) then
        tmp = x * (1.0d0 - z)
    else
        tmp = t * z
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.2e+14) {
		tmp = x;
	} else if ((y <= 1.2e+206) || !(y <= 1.42e+251)) {
		tmp = x * (1.0 - z);
	} else {
		tmp = t * z;
	}
	return tmp;
}
y = abs(y)
def code(x, y, z, t):
	tmp = 0
	if y <= 2.2e+14:
		tmp = x
	elif (y <= 1.2e+206) or not (y <= 1.42e+251):
		tmp = x * (1.0 - z)
	else:
		tmp = t * z
	return tmp
y = abs(y)
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 2.2e+14)
		tmp = x;
	elseif ((y <= 1.2e+206) || !(y <= 1.42e+251))
		tmp = Float64(x * Float64(1.0 - z));
	else
		tmp = Float64(t * z);
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 2.2e+14)
		tmp = x;
	elseif ((y <= 1.2e+206) || ~((y <= 1.42e+251)))
		tmp = x * (1.0 - z);
	else
		tmp = t * z;
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[y, 2.2e+14], x, If[Or[LessEqual[y, 1.2e+206], N[Not[LessEqual[y, 1.42e+251]], $MachinePrecision]], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(t * z), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.2 \cdot 10^{+14}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 1.2 \cdot 10^{+206} \lor \neg \left(y \leq 1.42 \cdot 10^{+251}\right):\\
\;\;\;\;x \cdot \left(1 - z\right)\\

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


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

    1. Initial program 93.6%

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

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

    if 2.2e14 < y < 1.2e206 or 1.41999999999999995e251 < y

    1. Initial program 76.7%

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

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

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

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

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

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

    if 1.2e206 < y < 1.41999999999999995e251

    1. Initial program 84.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.2 \cdot 10^{+14}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+206} \lor \neg \left(y \leq 1.42 \cdot 10^{+251}\right):\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \]

Alternative 7: 76.3% accurate, 19.3× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 2.5 \cdot 10^{-49}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\left(x + t \cdot z\right) - x \cdot z\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= y 2.5e-49) x (- (+ x (* t z)) (* x z))))
y = abs(y);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.5e-49) {
		tmp = x;
	} else {
		tmp = (x + (t * z)) - (x * z);
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= 2.5d-49) then
        tmp = x
    else
        tmp = (x + (t * z)) - (x * z)
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.5e-49) {
		tmp = x;
	} else {
		tmp = (x + (t * z)) - (x * z);
	}
	return tmp;
}
y = abs(y)
def code(x, y, z, t):
	tmp = 0
	if y <= 2.5e-49:
		tmp = x
	else:
		tmp = (x + (t * z)) - (x * z)
	return tmp
y = abs(y)
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 2.5e-49)
		tmp = x;
	else
		tmp = Float64(Float64(x + Float64(t * z)) - Float64(x * z));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 2.5e-49)
		tmp = x;
	else
		tmp = (x + (t * z)) - (x * z);
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[y, 2.5e-49], x, N[(N[(x + N[(t * z), $MachinePrecision]), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5 \cdot 10^{-49}:\\
\;\;\;\;x\\

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


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

    1. Initial program 93.2%

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

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

    if 2.4999999999999999e-49 < y

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 65.0% accurate, 23.3× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 2.6 \cdot 10^{+98}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+253}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= y 2.6e+98) x (if (<= y 1.6e+253) (* z (- t x)) (* x (- 1.0 z)))))
y = abs(y);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.6e+98) {
		tmp = x;
	} else if (y <= 1.6e+253) {
		tmp = z * (t - x);
	} else {
		tmp = x * (1.0 - z);
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= 2.6d+98) then
        tmp = x
    else if (y <= 1.6d+253) then
        tmp = z * (t - x)
    else
        tmp = x * (1.0d0 - z)
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.6e+98) {
		tmp = x;
	} else if (y <= 1.6e+253) {
		tmp = z * (t - x);
	} else {
		tmp = x * (1.0 - z);
	}
	return tmp;
}
y = abs(y)
def code(x, y, z, t):
	tmp = 0
	if y <= 2.6e+98:
		tmp = x
	elif y <= 1.6e+253:
		tmp = z * (t - x)
	else:
		tmp = x * (1.0 - z)
	return tmp
y = abs(y)
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 2.6e+98)
		tmp = x;
	elseif (y <= 1.6e+253)
		tmp = Float64(z * Float64(t - x));
	else
		tmp = Float64(x * Float64(1.0 - z));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 2.6e+98)
		tmp = x;
	elseif (y <= 1.6e+253)
		tmp = z * (t - x);
	else
		tmp = x * (1.0 - z);
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[y, 2.6e+98], x, If[LessEqual[y, 1.6e+253], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6 \cdot 10^{+98}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 1.6 \cdot 10^{+253}:\\
\;\;\;\;z \cdot \left(t - x\right)\\

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


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

    1. Initial program 93.2%

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

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

    if 2.6e98 < y < 1.6000000000000002e253

    1. Initial program 72.7%

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

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

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

    if 1.6000000000000002e253 < y

    1. Initial program 67.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.6 \cdot 10^{+98}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+253}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \end{array} \]

Alternative 9: 76.8% accurate, 23.5× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.55 \cdot 10^{-50}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= y 1.55e-50) x (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 1.55e-50) {
		tmp = x;
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= 1.55d-50) then
        tmp = x
    else
        tmp = x + (z * (t - x))
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 1.55e-50) {
		tmp = x;
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
y = abs(y)
def code(x, y, z, t):
	tmp = 0
	if y <= 1.55e-50:
		tmp = x
	else:
		tmp = x + (z * (t - x))
	return tmp
y = abs(y)
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 1.55e-50)
		tmp = x;
	else
		tmp = Float64(x + Float64(z * Float64(t - x)));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 1.55e-50)
		tmp = x;
	else
		tmp = x + (z * (t - x));
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[y, 1.55e-50], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.55 \cdot 10^{-50}:\\
\;\;\;\;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.5500000000000001e-50

    1. Initial program 93.2%

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

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

    if 1.5500000000000001e-50 < y

    1. Initial program 81.2%

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

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

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

Alternative 10: 60.9% accurate, 29.9× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{-280}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-169}:\\ \;\;\;\;t \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= x -1.7e-280) x (if (<= x 3e-169) (* t z) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -1.7e-280) {
		tmp = x;
	} else if (x <= 3e-169) {
		tmp = t * z;
	} else {
		tmp = x;
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x <= (-1.7d-280)) then
        tmp = x
    else if (x <= 3d-169) then
        tmp = t * z
    else
        tmp = x
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -1.7e-280) {
		tmp = x;
	} else if (x <= 3e-169) {
		tmp = t * z;
	} else {
		tmp = x;
	}
	return tmp;
}
y = abs(y)
def code(x, y, z, t):
	tmp = 0
	if x <= -1.7e-280:
		tmp = x
	elif x <= 3e-169:
		tmp = t * z
	else:
		tmp = x
	return tmp
y = abs(y)
function code(x, y, z, t)
	tmp = 0.0
	if (x <= -1.7e-280)
		tmp = x;
	elseif (x <= 3e-169)
		tmp = Float64(t * z);
	else
		tmp = x;
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= -1.7e-280)
		tmp = x;
	elseif (x <= 3e-169)
		tmp = t * z;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[x, -1.7e-280], x, If[LessEqual[x, 3e-169], N[(t * z), $MachinePrecision], x]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-280}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 3 \cdot 10^{-169}:\\
\;\;\;\;t \cdot z\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.6999999999999999e-280 or 2.9999999999999999e-169 < x

    1. Initial program 92.6%

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

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

    if -1.6999999999999999e-280 < x < 2.9999999999999999e-169

    1. Initial program 76.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{-280}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-169}:\\ \;\;\;\;t \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 11: 70.0% accurate, 30.2× speedup?

\[\begin{array}{l} y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 2.8 \cdot 10^{-51}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot z\\ \end{array} \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z t) :precision binary64 (if (<= y 2.8e-51) x (+ x (* t z))))
y = abs(y);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.8e-51) {
		tmp = x;
	} else {
		tmp = x + (t * z);
	}
	return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= 2.8d-51) then
        tmp = x
    else
        tmp = x + (t * z)
    end if
    code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.8e-51) {
		tmp = x;
	} else {
		tmp = x + (t * z);
	}
	return tmp;
}
y = abs(y)
def code(x, y, z, t):
	tmp = 0
	if y <= 2.8e-51:
		tmp = x
	else:
		tmp = x + (t * z)
	return tmp
y = abs(y)
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 2.8e-51)
		tmp = x;
	else
		tmp = Float64(x + Float64(t * z));
	end
	return tmp
end
y = abs(y)
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 2.8e-51)
		tmp = x;
	else
		tmp = x + (t * z);
	end
	tmp_2 = tmp;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[y, 2.8e-51], x, N[(x + N[(t * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.8 \cdot 10^{-51}:\\
\;\;\;\;x\\

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


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

    1. Initial program 93.2%

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

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

    if 2.8e-51 < y

    1. Initial program 81.2%

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

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

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

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

Alternative 12: 59.6% accurate, 213.0× speedup?

\[\begin{array}{l} y = |y|\\ \\ x \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z t) :precision binary64 x)
y = abs(y);
double code(double x, double y, double z, double t) {
	return x;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
	return x;
}
y = abs(y)
def code(x, y, z, t):
	return x
y = abs(y)
function code(x, y, z, t)
	return x
end
y = abs(y)
function tmp = code(x, y, z, t)
	tmp = x;
end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := x
\begin{array}{l}
y = |y|\\
\\
x
\end{array}
Derivation
  1. Initial program 90.0%

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

    \[\leadsto \color{blue}{x} \]
  3. Final simplification58.3%

    \[\leadsto x \]

Developer target: 96.7% 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 2023271 
(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))))))