SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 92.6% → 96.2%
Time: 18.4s
Alternatives: 10
Speedup: 0.7×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 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: 92.6% 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: 96.2% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;x + 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))))) < 1.99999999999999997e307

    1. Initial program 98.3%

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

    if 1.99999999999999997e307 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

    1. Initial program 57.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right) \leq 2 \cdot 10^{+307}:\\ \;\;\;\;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} \]

Alternative 2: 96.9% 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 95.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. +-commutative95.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.3%

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

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

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

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

Alternative 3: 85.2% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.59999999999999989e-101 or 2.4e10 < 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. Taylor expanded in x around 0 10.2%

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

        \[\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. *-commutative10.1%

        \[\leadsto x + \color{blue}{\left(z \cdot y\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) \]
      3. associate-/r*10.1%

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

        \[\leadsto x + \left(z \cdot y\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}}}}} \]
      5. rec-exp10.1%

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

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

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

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

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

    if -1.59999999999999989e-101 < t < 2.4e10

    1. Initial program 94.3%

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

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

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

Alternative 4: 85.3% accurate, 1.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.45e-101 or 3.5e9 < 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. Taylor expanded in x around 0 10.2%

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

        \[\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. *-commutative10.1%

        \[\leadsto x + \color{blue}{\left(z \cdot y\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) \]
      3. associate-/r*10.1%

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

        \[\leadsto x + \left(z \cdot y\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}}}}} \]
      5. rec-exp10.1%

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

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

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

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

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

    if -1.45e-101 < t < 3.5e9

    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. flip--74.1%

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

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{\left(\frac{0}{-\left(\tanh \left(\frac{t}{y}\right) + \tanh \left(\frac{x}{y}\right)\right)} - \frac{\left(y \cdot z\right) \cdot \left({\tanh \left(\frac{t}{y}\right)}^{2} - {\tanh \left(\frac{x}{y}\right)}^{2}\right)}{-\left(\tanh \left(\frac{t}{y}\right) + \tanh \left(\frac{x}{y}\right)\right)}\right)} \]
      4. neg-mul-174.1%

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

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

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

        \[\leadsto x + \left(\frac{0}{-\left(\tanh \left(\frac{t}{y}\right) + \tanh \left(\frac{x}{y}\right)\right)} - \frac{y \cdot z}{\color{blue}{-1}} \cdot \frac{{\tanh \left(\frac{t}{y}\right)}^{2} - {\tanh \left(\frac{x}{y}\right)}^{2}}{\tanh \left(\frac{t}{y}\right) + \tanh \left(\frac{x}{y}\right)}\right) \]
    5. Applied egg-rr80.6%

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

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

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{\left(-y\right)} \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) \]
      3. associate-/r*17.0%

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

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

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

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

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

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

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

Alternative 5: 83.3% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 97.3%

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

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)\right)} \]
    3. Step-by-step derivation
      1. associate-*r*21.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. *-commutative21.3%

        \[\leadsto x + \color{blue}{\left(z \cdot y\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) \]
      3. associate-/r*21.3%

        \[\leadsto x + \left(z \cdot y\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) \]
      4. div-sub21.3%

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

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

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

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

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

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

    if 1.22e120 < y

    1. Initial program 84.1%

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

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

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

Alternative 6: 63.5% accurate, 23.3× speedup?

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

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

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

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


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

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

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

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

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

      \[\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. Taylor expanded in y around 0 64.5%

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

    if 1.35e9 < y < 1.04999999999999993e188

    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. Taylor expanded in x around 0 80.6%

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

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

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

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(-\frac{x}{y}\right)} \]
      2. distribute-frac-neg58.5%

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

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

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

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

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

        \[\leadsto \color{blue}{x} + \left(-z\right) \cdot x \]
      4. cancel-sign-sub-inv61.1%

        \[\leadsto \color{blue}{x - z \cdot x} \]
      5. *-commutative61.1%

        \[\leadsto x - \color{blue}{x \cdot z} \]
    9. Simplified61.1%

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

    if 1.04999999999999993e188 < y

    1. Initial program 77.8%

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

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

        \[\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. *-commutative30.1%

        \[\leadsto x + \color{blue}{\left(z \cdot y\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) \]
      3. associate-/r*30.1%

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

        \[\leadsto x + \left(z \cdot y\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}}}}} \]
      5. rec-exp30.1%

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

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

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

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

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

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

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

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

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

Alternative 7: 68.3% accurate, 23.5× speedup?

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

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

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


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

    1. Initial program 96.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. +-commutative96.9%

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

        \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} + x \]
      3. fma-def98.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. Taylor expanded in y around 0 65.3%

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

    if 1.24999999999999991e-35 < y

    1. Initial program 91.5%

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

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

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

Alternative 8: 59.8% accurate, 29.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.85 \cdot 10^{-117}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 2.5 \cdot 10^{-227}:\\
\;\;\;\;z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.85e-117 or 2.4999999999999998e-227 < x

    1. Initial program 97.0%

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

        \[\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*99.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-def99.9%

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

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

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

    if -2.85e-117 < x < 2.4999999999999998e-227

    1. Initial program 90.3%

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

      \[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\frac{e^{\frac{t}{y}}}{e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}} - \frac{1}{e^{\frac{t}{y}} \cdot \left(e^{\frac{t}{y}} + \frac{1}{e^{\frac{t}{y}}}\right)}\right)\right)} \]
    3. Step-by-step derivation
      1. associate-*r*9.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. *-commutative9.4%

        \[\leadsto x + \color{blue}{\left(z \cdot y\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) \]
      3. associate-/r*9.4%

        \[\leadsto x + \left(z \cdot y\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) \]
      4. div-sub9.4%

        \[\leadsto x + \left(z \cdot y\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}}}}} \]
      5. rec-exp9.4%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot z + x} \]
    8. Taylor expanded in t around inf 40.2%

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

        \[\leadsto \color{blue}{z \cdot t} \]
    10. Simplified40.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.85 \cdot 10^{-117}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-227}:\\ \;\;\;\;z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 9: 64.9% accurate, 30.2× speedup?

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

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

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


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

    1. Initial program 97.2%

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

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

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

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

      \[\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. Taylor expanded in y around 0 62.9%

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

    if 4.4e67 < y

    1. Initial program 88.2%

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

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

        \[\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. *-commutative31.1%

        \[\leadsto x + \color{blue}{\left(z \cdot y\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) \]
      3. associate-/r*31.1%

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

        \[\leadsto x + \left(z \cdot y\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}}}}} \]
      5. rec-exp31.2%

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

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

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

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

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

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

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

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

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

Alternative 10: 59.2% 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 95.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. +-commutative95.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.3%

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

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

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification57.9%

    \[\leadsto x \]

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

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

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