SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 94.1% → 96.5%
Time: 14.3s
Alternatives: 9
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 9 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: 94.1% 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.5% accurate, 1.0× speedup?

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

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


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

    1. Initial program 95.8%

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

    if 7.6000000000000002e64 < y

    1. Initial program 76.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.8% accurate, 0.7× speedup?

\[\begin{array}{l} y = |y|\\ \\ \mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), z, x\right) \end{array} \]
NOTE: y should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (fma (* y (- (tanh (/ t y)) (tanh (/ x y)))) z x))
y = abs(y);
double code(double x, double y, double z, double t) {
	return fma((y * (tanh((t / y)) - tanh((x / y)))), z, x);
}
y = abs(y)
function code(x, y, z, t)
	return fma(Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), z, x)
end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := N[(N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), z, x\right)
\end{array}
Derivation
  1. Initial program 91.9%

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

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

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

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

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

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

Alternative 3: 86.7% accurate, 1.0× speedup?

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

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


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

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.91999999999999999e65 < y

    1. Initial program 76.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 86.6% accurate, 1.9× speedup?

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

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


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

    1. Initial program 95.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 29.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*28.8%

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

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

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

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

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

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

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

    if 2.3199999999999999e64 < y

    1. Initial program 76.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 83.9% accurate, 1.9× speedup?

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

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


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

    1. Initial program 95.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 29.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*28.8%

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

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

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

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

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

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

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

    if 4.1500000000000002e65 < y

    1. Initial program 76.4%

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

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

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

Alternative 6: 69.5% accurate, 19.0× speedup?

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

\mathbf{elif}\;y \leq 6.2 \cdot 10^{+86} \lor \neg \left(y \leq 3.4 \cdot 10^{+129}\right):\\
\;\;\;\;x + t \cdot z\\

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


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

    1. Initial program 95.3%

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

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

    if 4.29999999999999964e-43 < y < 6.2000000000000004e86 or 3.40000000000000018e129 < 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. Taylor expanded in y around inf 81.2%

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

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

    if 6.2000000000000004e86 < y < 3.40000000000000018e129

    1. Initial program 82.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x} - z \cdot x \]
    7. Simplified62.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.3 \cdot 10^{-43}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{+86} \lor \neg \left(y \leq 3.4 \cdot 10^{+129}\right):\\ \;\;\;\;x + t \cdot z\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot z\\ \end{array} \]

Alternative 7: 77.3% accurate, 23.5× speedup?

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

    1. Initial program 95.3%

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

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

    if 1.10000000000000003e-42 < y

    1. Initial program 83.0%

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

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

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

Alternative 8: 70.2% accurate, 30.2× speedup?

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

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


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

    1. Initial program 95.3%

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

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

    if 2.1000000000000001e-43 < y

    1. Initial program 83.0%

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

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

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

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

Alternative 9: 60.3% accurate, 213.0× speedup?

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

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

    \[\leadsto x \]

Developer target: 97.1% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2023279 
(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))))))