SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.7% → 98.0%
Time: 10.4s
Alternatives: 11
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 93.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: 98.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(z, y \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 z (* y (- (tanh (/ t y)) (tanh (/ x y)))) x))
double code(double x, double y, double z, double t) {
	return fma(z, (y * (tanh((t / y)) - tanh((x / y)))), x);
}
function code(x, y, z, t)
	return fma(z, Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), x)
end
code[x_, y_, z_, t_] := N[(z * N[(y * 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(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)
\end{array}
Derivation
  1. Initial program 92.6%

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

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

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

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

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

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

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

Alternative 2: 97.4% 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}
Derivation
  1. Initial program 92.6%

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

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

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

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

Alternative 3: 84.5% accurate, 1.8× speedup?

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

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

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

\mathbf{elif}\;t \leq 1.06 \cdot 10^{-129}:\\
\;\;\;\;x + \left(z \cdot y\right) \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.0200000000000001e-24 or 1.0600000000000001e-129 < t

    1. Initial program 94.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. associate-*l*99.5%

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

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

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

        \[\leadsto x + y \cdot \color{blue}{\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)} \]
      2. associate-/r*12.6%

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

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

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

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

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

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

    if -1.0200000000000001e-24 < t < -1.45e-236

    1. Initial program 84.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. +-commutative84.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. *-commutative84.9%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, y \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(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)} \]
    4. Taylor expanded in y around inf 93.6%

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

    if -1.45e-236 < t < 1.0600000000000001e-129

    1. Initial program 94.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.02 \cdot 10^{-24}:\\ \;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\ \mathbf{elif}\;t \leq -1.45 \cdot 10^{-236}:\\ \;\;\;\;x + z \cdot \left(t - x\right)\\ \mathbf{elif}\;t \leq 1.06 \cdot 10^{-129}:\\ \;\;\;\;x + \left(z \cdot y\right) \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\ \end{array} \]

Alternative 4: 83.4% accurate, 1.9× speedup?

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

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

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


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

    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. associate-*l*99.3%

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

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

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

        \[\leadsto x + y \cdot \color{blue}{\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)} \]
      2. associate-/r*22.5%

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

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

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

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

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

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

    if 9.9999999999999995e32 < y

    1. Initial program 79.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. associate-*l*97.4%

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

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

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

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

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

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

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

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

Alternative 5: 82.8% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3.5 \cdot 10^{+98}:\\ \;\;\;\;x + y \cdot \left(z \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 3.5e+98) (+ x (* y (* z (tanh (/ t y))))) (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 3.5e+98) {
		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 <= 3.5d+98) 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 <= 3.5e+98) {
		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 <= 3.5e+98:
		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 <= 3.5e+98)
		tmp = Float64(x + Float64(y * Float64(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 <= 3.5e+98)
		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, 3.5e+98], N[(x + N[(y * N[(z * 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 3.5 \cdot 10^{+98}:\\
\;\;\;\;x + y \cdot \left(z \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 < 3.5e98

    1. Initial program 96.7%

      \[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. associate-*l*99.3%

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

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

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

        \[\leadsto x + y \cdot \color{blue}{\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)} \]
      2. associate-/r*22.3%

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

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

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

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

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

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

    if 3.5e98 < y

    1. Initial program 76.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. +-commutative76.5%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, y \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(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)} \]
    4. Taylor expanded in y around inf 92.8%

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

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

Alternative 6: 64.2% accurate, 19.0× speedup?

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

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

\mathbf{elif}\;y \leq 5.6 \cdot 10^{+101} \lor \neg \left(y \leq 2.4 \cdot 10^{+217}\right):\\
\;\;\;\;x + z \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 9.4000000000000003e-20

    1. Initial program 96.7%

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

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

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

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

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

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

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

    if 9.4000000000000003e-20 < y < 5.59999999999999962e101 or 2.3999999999999998e217 < y

    1. Initial program 86.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. associate-*l*98.7%

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

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

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

        \[\leadsto x + y \cdot \color{blue}{\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)} \]
      2. associate-/r*30.3%

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

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

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

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

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

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

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

    if 5.59999999999999962e101 < y < 2.3999999999999998e217

    1. Initial program 78.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. +-commutative78.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. *-commutative78.4%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - z \cdot x} \]
    7. Simplified71.1%

      \[\leadsto \color{blue}{x - z \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 9.4 \cdot 10^{-20}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{+101} \lor \neg \left(y \leq 2.4 \cdot 10^{+217}\right):\\ \;\;\;\;x + z \cdot t\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot x\\ \end{array} \]

Alternative 7: 59.0% accurate, 20.9× speedup?

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

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

\mathbf{elif}\;z \leq 1.2 \cdot 10^{+165} \lor \neg \left(z \leq 5 \cdot 10^{+215}\right):\\
\;\;\;\;z \cdot \left(-x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.05000000000000001e80 or 1.2e165 < z < 5.0000000000000001e215

    1. Initial program 95.6%

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

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

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

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

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

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

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

    if 1.05000000000000001e80 < z < 1.2e165 or 5.0000000000000001e215 < z

    1. Initial program 75.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. +-commutative75.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-z \cdot x} \]
      2. distribute-rgt-neg-out45.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 1.05 \cdot 10^{+80}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{+165} \lor \neg \left(z \leq 5 \cdot 10^{+215}\right):\\ \;\;\;\;z \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 8: 68.7% accurate, 23.5× speedup?

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

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

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


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

    1. Initial program 96.7%

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

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

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

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

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

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

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

    if 6.4000000000000002e-26 < y

    1. Initial program 83.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. +-commutative83.3%

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

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

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

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

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

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

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

Alternative 9: 61.9% accurate, 30.2× speedup?

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

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

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


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

    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. *-commutative97.1%

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

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

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

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

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

    if 1.8e92 < y

    1. Initial program 75.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. +-commutative75.6%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, y \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(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)} \]
    4. Taylor expanded in y around inf 91.5%

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

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

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

Alternative 10: 65.1% accurate, 30.2× speedup?

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

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

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


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

    1. Initial program 96.7%

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

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

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

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

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

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

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

    if 2.2999999999999999e-20 < y

    1. Initial program 83.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. associate-*l*97.9%

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

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

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

        \[\leadsto x + y \cdot \color{blue}{\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)} \]
      2. associate-/r*32.2%

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

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

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

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

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

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

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

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

Alternative 11: 60.1% 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 92.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. +-commutative92.6%

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification60.1%

    \[\leadsto x \]

Developer target: 97.4% 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 2023258 
(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))))))