SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.7% → 99.0%
Time: 16.2s
Alternatives: 10
Speedup: 0.5×

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 10 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.7% 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: 99.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tanh \left(\frac{x}{y}\right)\\ t_2 := \tanh \left(\frac{t}{y}\right)\\ \mathbf{if}\;x - \left(y \cdot z\right) \cdot \left(t\_1 - t\_2\right) \leq 10^{+308}:\\ \;\;\;\;\mathsf{fma}\left(y \cdot \left(t\_2 - t\_1\right), z, x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t - x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (tanh (/ x y))) (t_2 (tanh (/ t y))))
   (if (<= (- x (* (* y z) (- t_1 t_2))) 1e+308)
     (fma (* y (- t_2 t_1)) z x)
     (* z (- t x)))))
double code(double x, double y, double z, double t) {
	double t_1 = tanh((x / y));
	double t_2 = tanh((t / y));
	double tmp;
	if ((x - ((y * z) * (t_1 - t_2))) <= 1e+308) {
		tmp = fma((y * (t_2 - t_1)), z, x);
	} else {
		tmp = z * (t - x);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = tanh(Float64(x / y))
	t_2 = tanh(Float64(t / y))
	tmp = 0.0
	if (Float64(x - Float64(Float64(y * z) * Float64(t_1 - t_2))) <= 1e+308)
		tmp = fma(Float64(y * Float64(t_2 - t_1)), z, x);
	else
		tmp = Float64(z * Float64(t - x));
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(x - N[(N[(y * z), $MachinePrecision] * N[(t$95$1 - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+308], N[(N[(y * N[(t$95$2 - t$95$1), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \tanh \left(\frac{x}{y}\right)\\
t_2 := \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;x - \left(y \cdot z\right) \cdot \left(t\_1 - t\_2\right) \leq 10^{+308}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(t\_2 - t\_1\right), z, x\right)\\

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


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

    1. Initial program 98.4%

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

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

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

      \[\leadsto \color{blue}{x + z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity99.9%

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), z, x\right) \cdot 1} \]
    7. Step-by-step derivation
      1. *-rgt-identity100.0%

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

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

    if 1e308 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

    1. Initial program 40.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. cancel-sign-sub40.6%

        \[\leadsto \color{blue}{x - \left(-y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      2. distribute-lft-neg-out40.6%

        \[\leadsto x - \color{blue}{\left(-\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
      3. distribute-rgt-neg-in40.6%

        \[\leadsto x - \color{blue}{\left(y \cdot z\right) \cdot \left(-\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
      4. neg-sub040.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x + t \cdot z\right) - 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)} \]
    6. Step-by-step derivation
      1. associate-*r*0.0%

        \[\leadsto \left(x + t \cdot z\right) - \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)} \]
      2. associate-/r*0.0%

        \[\leadsto \left(x + t \cdot z\right) - \left(y \cdot z\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) \]
      3. rec-exp0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.0% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 98.4%

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

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

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

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

    if 1e308 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

    1. Initial program 40.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. cancel-sign-sub40.6%

        \[\leadsto \color{blue}{x - \left(-y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      2. distribute-lft-neg-out40.6%

        \[\leadsto x - \color{blue}{\left(-\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
      3. distribute-rgt-neg-in40.6%

        \[\leadsto x - \color{blue}{\left(y \cdot z\right) \cdot \left(-\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
      4. neg-sub040.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x + t \cdot z\right) - 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)} \]
    6. Step-by-step derivation
      1. associate-*r*0.0%

        \[\leadsto \left(x + t \cdot z\right) - \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)} \]
      2. associate-/r*0.0%

        \[\leadsto \left(x + t \cdot z\right) - \left(y \cdot z\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) \]
      3. rec-exp0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 84.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \tanh \left(\frac{t}{y}\right)\\ \mathbf{if}\;y \leq 1.15 \cdot 10^{+41}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(t\_1 - x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (tanh (/ t y)))))
   (if (<= y 1.15e+41) (fma t_1 z x) (+ x (* z (- t_1 x))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * tanh((t / y));
	double tmp;
	if (y <= 1.15e+41) {
		tmp = fma(t_1, z, x);
	} else {
		tmp = x + (z * (t_1 - x));
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(y * tanh(Float64(t / y)))
	tmp = 0.0
	if (y <= 1.15e+41)
		tmp = fma(t_1, z, x);
	else
		tmp = Float64(x + Float64(z * Float64(t_1 - x)));
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.15e+41], N[(t$95$1 * z + x), $MachinePrecision], N[(x + N[(z * N[(t$95$1 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y \cdot \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;y \leq 1.15 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, x\right)\\

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


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

    1. Initial program 95.2%

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

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

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

      \[\leadsto \color{blue}{x + z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity97.4%

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), z, x\right) \cdot 1} \]
    7. Step-by-step derivation
      1. *-rgt-identity97.4%

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

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

      \[\leadsto \mathsf{fma}\left(y \cdot \color{blue}{\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)}, z, x\right) \]
    10. Step-by-step derivation
      1. associate-/r*24.7%

        \[\leadsto \mathsf{fma}\left(y \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), z, x\right) \]
      2. rec-exp24.7%

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

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

        \[\leadsto \mathsf{fma}\left(y \cdot \frac{e^{\frac{t}{y}} - e^{-\frac{t}{y}}}{e^{\frac{t}{y}} + \color{blue}{e^{-\frac{t}{y}}}}, z, x\right) \]
      5. tanh-def-a87.0%

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

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

    if 1.1499999999999999e41 < y

    1. Initial program 91.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. *-commutative91.3%

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

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

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

      \[\leadsto x + z \cdot \color{blue}{\left(-1 \cdot x + y \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)} \]
    6. Step-by-step derivation
      1. +-commutative62.6%

        \[\leadsto x + z \cdot \color{blue}{\left(y \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) + -1 \cdot x\right)} \]
      2. mul-1-neg62.6%

        \[\leadsto x + z \cdot \left(y \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) + \color{blue}{\left(-x\right)}\right) \]
      3. unsub-neg62.6%

        \[\leadsto x + z \cdot \color{blue}{\left(y \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) - x\right)} \]
    7. Simplified96.7%

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

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

Alternative 4: 84.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tanh \left(\frac{t}{y}\right)\\ \mathbf{if}\;y \leq 1.66 \cdot 10^{+43}:\\ \;\;\;\;x + \left(y \cdot z\right) \cdot t\_1\\ \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 1.66e+43) (+ x (* (* y z) t_1)) (+ 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 <= 1.66e+43) {
		tmp = x + ((y * z) * t_1);
	} 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 <= 1.66d+43) then
        tmp = x + ((y * z) * t_1)
    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 <= 1.66e+43) {
		tmp = x + ((y * z) * t_1);
	} 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 <= 1.66e+43:
		tmp = x + ((y * z) * t_1)
	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 <= 1.66e+43)
		tmp = Float64(x + Float64(Float64(y * z) * t_1));
	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 <= 1.66e+43)
		tmp = x + ((y * z) * t_1);
	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, 1.66e+43], N[(x + N[(N[(y * z), $MachinePrecision] * t$95$1), $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 1.66 \cdot 10^{+43}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot t\_1\\

\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 < 1.6600000000000001e43

    1. Initial program 95.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.6600000000000001e43 < y

    1. Initial program 91.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. *-commutative91.3%

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

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

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

      \[\leadsto x + z \cdot \color{blue}{\left(-1 \cdot x + y \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)} \]
    6. Step-by-step derivation
      1. +-commutative62.6%

        \[\leadsto x + z \cdot \color{blue}{\left(y \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) + -1 \cdot x\right)} \]
      2. mul-1-neg62.6%

        \[\leadsto x + z \cdot \left(y \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) + \color{blue}{\left(-x\right)}\right) \]
      3. unsub-neg62.6%

        \[\leadsto x + z \cdot \color{blue}{\left(y \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) - x\right)} \]
    7. Simplified96.7%

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

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

Alternative 5: 82.8% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 95.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. *-commutative95.3%

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

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

      \[\leadsto \color{blue}{x + z \cdot \left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 27.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)} \]
    6. Step-by-step derivation
      1. associate-*r*27.3%

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

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

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

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

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

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

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

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

    if 5.1e172 < y

    1. Initial program 85.9%

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

        \[\leadsto \color{blue}{x - \left(-y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      2. distribute-lft-neg-out85.9%

        \[\leadsto x - \color{blue}{\left(-\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
      3. distribute-rgt-neg-in85.9%

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

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

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

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

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

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

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

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

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

Alternative 6: 63.8% accurate, 14.2× speedup?

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

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

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

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


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

    1. Initial program 95.2%

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

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

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

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

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

    if 3.19999999999999985e38 < y < 1.84999999999999997e225

    1. Initial program 95.5%

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

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

        \[\leadsto x - \color{blue}{\left(-\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
      3. distribute-rgt-neg-in95.5%

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

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

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

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

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

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

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

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

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

    if 1.84999999999999997e225 < y

    1. Initial program 76.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. cancel-sign-sub76.3%

        \[\leadsto \color{blue}{x - \left(-y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      2. distribute-lft-neg-out76.3%

        \[\leadsto x - \color{blue}{\left(-\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
      3. distribute-rgt-neg-in76.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x + t \cdot z\right) - 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)} \]
    6. Step-by-step derivation
      1. associate-*r*41.7%

        \[\leadsto \left(x + t \cdot z\right) - \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)} \]
      2. associate-/r*41.7%

        \[\leadsto \left(x + t \cdot z\right) - \left(y \cdot z\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) \]
      3. rec-exp41.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 69.5% accurate, 17.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 32000:\\
\;\;\;\;x\\

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


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

    1. Initial program 95.1%

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

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

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

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

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

    if 32000 < y

    1. Initial program 91.9%

      \[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. cancel-sign-sub91.9%

        \[\leadsto \color{blue}{x - \left(-y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      2. distribute-lft-neg-out91.9%

        \[\leadsto x - \color{blue}{\left(-\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
      3. distribute-rgt-neg-in91.9%

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

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

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

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

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

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

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

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

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

Alternative 8: 62.5% accurate, 21.3× speedup?

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

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

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


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

    1. Initial program 95.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. *-commutative95.3%

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

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

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

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

    if 4.5999999999999999e169 < y

    1. Initial program 85.9%

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

        \[\leadsto \color{blue}{x - \left(-y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      2. distribute-lft-neg-out85.9%

        \[\leadsto x - \color{blue}{\left(-\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
      3. distribute-rgt-neg-in85.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x + t \cdot z\right) - 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)} \]
    6. Step-by-step derivation
      1. associate-*r*44.5%

        \[\leadsto \left(x + t \cdot z\right) - \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)} \]
      2. associate-/r*44.5%

        \[\leadsto \left(x + t \cdot z\right) - \left(y \cdot z\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) \]
      3. rec-exp44.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 60.5% accurate, 23.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 5.8 \cdot 10^{+254}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 5.7999999999999999e254

    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. Step-by-step derivation
      1. *-commutative94.8%

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

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

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

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

    if 5.7999999999999999e254 < z

    1. Initial program 86.1%

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

        \[\leadsto \color{blue}{x - \left(-y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      2. distribute-lft-neg-out86.1%

        \[\leadsto x - \color{blue}{\left(-\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
      3. distribute-rgt-neg-in86.1%

        \[\leadsto x - \color{blue}{\left(y \cdot z\right) \cdot \left(-\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} \]
      4. neg-sub086.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x + t \cdot z\right) - 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)} \]
    6. Step-by-step derivation
      1. associate-*r*1.1%

        \[\leadsto \left(x + t \cdot z\right) - \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)} \]
      2. associate-/r*1.1%

        \[\leadsto \left(x + t \cdot z\right) - \left(y \cdot z\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) \]
      3. rec-exp1.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \left(-x\right)} \]
    14. Simplified44.4%

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

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

Alternative 10: 60.0% 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.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. *-commutative94.3%

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

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

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

    \[\leadsto \color{blue}{x} \]
  6. Final simplification65.0%

    \[\leadsto x \]
  7. Add Preprocessing

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

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

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