SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.8% → 97.1%
Time: 17.0s
Alternatives: 11
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 11 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.8% 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: 97.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(y, \tanh \left(\frac{t}{y}\right) \cdot z - z \cdot \tanh \left(\frac{x}{y}\right), x\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma y (- (* (tanh (/ t y)) z) (* z (tanh (/ x y)))) x))
double code(double x, double y, double z, double t) {
	return fma(y, ((tanh((t / y)) * z) - (z * tanh((x / y)))), x);
}
function code(x, y, z, t)
	return fma(y, Float64(Float64(tanh(Float64(t / y)) * z) - Float64(z * tanh(Float64(x / y)))), x)
end
code[x_, y_, z_, t_] := N[(y * N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * z), $MachinePrecision] - N[(z * N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(y, \tanh \left(\frac{t}{y}\right) \cdot z - z \cdot \tanh \left(\frac{x}{y}\right), x\right)
\end{array}
Derivation
  1. Initial program 94.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. +-commutative94.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*97.9%

      \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} + x \]
    3. fma-define98.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
  5. Step-by-step derivation
    1. sub-neg98.0%

      \[\leadsto \mathsf{fma}\left(y, z \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) + \left(-\tanh \left(\frac{x}{y}\right)\right)\right)}, x\right) \]
    2. distribute-rgt-in98.0%

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

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

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

Alternative 2: 97.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma y (* z (- (tanh (/ t y)) (tanh (/ x y)))) x))
double code(double x, double y, double z, double t) {
	return fma(y, (z * (tanh((t / y)) - tanh((x / y)))), x);
}
function code(x, y, z, t)
	return fma(y, Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), x)
end
code[x_, y_, z_, t_] := N[(y * N[(z * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)
\end{array}
Derivation
  1. Initial program 94.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. +-commutative94.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*97.9%

      \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} + x \]
    3. fma-define98.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
  5. Add Preprocessing

Alternative 3: 95.2% accurate, 1.0× speedup?

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

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

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


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

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

    if 2.69999999999999994e189 < y

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

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

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

Alternative 4: 97.1% accurate, 1.0× speedup?

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

\\
x + y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z - z \cdot \tanh \left(\frac{x}{y}\right)\right)
\end{array}
Derivation
  1. Initial program 94.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. +-commutative94.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*97.9%

      \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} + x \]
    3. fma-define98.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
  5. Step-by-step derivation
    1. sub-neg98.0%

      \[\leadsto \mathsf{fma}\left(y, z \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) + \left(-\tanh \left(\frac{x}{y}\right)\right)\right)}, x\right) \]
    2. distribute-rgt-in98.0%

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

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

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

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

    \[\leadsto x + y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z - z \cdot \tanh \left(\frac{x}{y}\right)\right) \]
  10. Add Preprocessing

Alternative 5: 84.5% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.9000000000000002e-85 or 1.2e-36 < t

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

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

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

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

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

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

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

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

    if -2.9000000000000002e-85 < t < 1.2e-36

    1. Initial program 92.4%

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

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) + x} \]
      2. associate-*l*97.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-define97.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. Simplified97.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sub-neg97.0%

        \[\leadsto \mathsf{fma}\left(y, z \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) + \left(-\tanh \left(\frac{x}{y}\right)\right)\right)}, x\right) \]
      2. distribute-rgt-in97.0%

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

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

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

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

        \[\leadsto \color{blue}{x - \frac{y \cdot \left(z \cdot \left(e^{\frac{x}{y}} - \frac{1}{e^{\frac{x}{y}}}\right)\right)}{e^{\frac{x}{y}} + \frac{1}{e^{\frac{x}{y}}}}} \]
      3. associate-/l*25.2%

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

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

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

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

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

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

Alternative 6: 83.0% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 94.4%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 20.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*20.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-sub20.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-exp20.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-exp20.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-a76.1%

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

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

    if 2.6000000000000001e-63 < y

    1. Initial program 95.4%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. 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. Simplified89.6%

      \[\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 simplification79.4%

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

Alternative 7: 82.7% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 94.9%

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

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

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

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

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

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

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

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

    if 2.25000000000000002e176 < y

    1. Initial program 92.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 92.8%

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

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

Alternative 8: 65.0% accurate, 14.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 2.5 \cdot 10^{+16}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.85 \cdot 10^{+115}:\\ \;\;\;\;x - z \cdot x\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y 2.5e+16) x (if (<= y 2.85e+115) (- x (* z x)) (+ x (* t z)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.5e+16) {
		tmp = x;
	} else if (y <= 2.85e+115) {
		tmp = x - (z * x);
	} else {
		tmp = x + (t * z);
	}
	return tmp;
}
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+16) then
        tmp = x
    else if (y <= 2.85d+115) then
        tmp = x - (z * x)
    else
        tmp = x + (t * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.5e+16) {
		tmp = x;
	} else if (y <= 2.85e+115) {
		tmp = x - (z * x);
	} else {
		tmp = x + (t * z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 2.5e+16:
		tmp = x
	elif y <= 2.85e+115:
		tmp = x - (z * x)
	else:
		tmp = x + (t * z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 2.5e+16)
		tmp = x;
	elseif (y <= 2.85e+115)
		tmp = Float64(x - Float64(z * x));
	else
		tmp = Float64(x + Float64(t * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 2.5e+16)
		tmp = x;
	elseif (y <= 2.85e+115)
		tmp = x - (z * x);
	else
		tmp = x + (t * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.5e+16], x, If[LessEqual[y, 2.85e+115], N[(x - N[(z * x), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5 \cdot 10^{+16}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 2.85 \cdot 10^{+115}:\\
\;\;\;\;x - z \cdot x\\

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


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

    1. Initial program 94.8%

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

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

    if 2.5e16 < y < 2.84999999999999983e115

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

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

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

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

        \[\leadsto \color{blue}{x - x \cdot z} \]
      3. *-commutative67.8%

        \[\leadsto x - \color{blue}{z \cdot x} \]
    6. Simplified67.8%

      \[\leadsto \color{blue}{x - z \cdot x} \]

    if 2.84999999999999983e115 < y

    1. Initial program 92.3%

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

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

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

        \[\leadsto \color{blue}{t \cdot z + x} \]
    6. Simplified70.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.5 \cdot 10^{+16}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.85 \cdot 10^{+115}:\\ \;\;\;\;x - z \cdot x\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 68.2% accurate, 17.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{-26}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t) :precision binary64 (if (<= y 8e-26) x (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 8e-26) {
		tmp = x;
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
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 <= 8d-26) then
        tmp = x
    else
        tmp = x + (z * (t - x))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 8e-26) {
		tmp = x;
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 8e-26:
		tmp = x
	else:
		tmp = x + (z * (t - x))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 8e-26)
		tmp = x;
	else
		tmp = Float64(x + Float64(z * Float64(t - x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 8e-26)
		tmp = x;
	else
		tmp = x + (z * (t - x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 8e-26], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 94.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 x around inf 64.5%

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

    if 8.0000000000000003e-26 < y

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

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

Alternative 10: 65.4% accurate, 21.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 9 \cdot 10^{+73}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z t) :precision binary64 (if (<= y 9e+73) x (+ x (* t z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 9e+73) {
		tmp = x;
	} else {
		tmp = x + (t * z);
	}
	return tmp;
}
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 <= 9d+73) then
        tmp = x
    else
        tmp = x + (t * z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 9e+73) {
		tmp = x;
	} else {
		tmp = x + (t * z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 9e+73:
		tmp = x
	else:
		tmp = x + (t * z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 9e+73)
		tmp = x;
	else
		tmp = Float64(x + Float64(t * z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 9e+73)
		tmp = x;
	else
		tmp = x + (t * z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 9e+73], x, N[(x + N[(t * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{+73}:\\
\;\;\;\;x\\

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


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

    1. Initial program 94.9%

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

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

    if 8.99999999999999969e73 < y

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

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

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

        \[\leadsto \color{blue}{t \cdot z + x} \]
    6. Simplified71.5%

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

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

Alternative 11: 60.4% accurate, 213.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
	return x;
}
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
public static double code(double x, double y, double z, double t) {
	return x;
}
def code(x, y, z, t):
	return x
function code(x, y, z, t)
	return x
end
function tmp = code(x, y, z, t)
	tmp = x;
end
code[x_, y_, z_, t_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 94.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 x around inf 61.1%

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

Developer Target 1: 97.1% accurate, 1.0× speedup?

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

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

Reproduce

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

  :alt
  (! :herbie-platform default (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))))

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