SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.2% → 97.3%
Time: 12.3s
Alternatives: 10
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 10 alternatives:

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

Initial Program: 93.2% accurate, 1.0× speedup?

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

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

Alternative 1: 97.3% 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 95.1%

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

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

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

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

Alternative 2: 84.7% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.75000000000000006e-87 or 1.5e-89 < t

    1. Initial program 95.4%

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

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

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

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

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

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

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

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

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

    if -1.75000000000000006e-87 < t < 1.5e-89

    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 88.8%

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

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

Alternative 3: 73.1% accurate, 1.9× speedup?

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

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

\mathbf{elif}\;y \leq 3.4 \cdot 10^{-54}:\\
\;\;\;\;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 3 regimes
  2. if y < 9.7999999999999995e-157

    1. Initial program 95.5%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Step-by-step derivation
      1. 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. Taylor expanded in y around inf 56.5%

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

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

    if 9.7999999999999995e-157 < y < 3.39999999999999987e-54

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

      \[\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)} \]
    5. Step-by-step derivation
      1. associate-*r*23.9%

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

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

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

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

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

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

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

    if 3.39999999999999987e-54 < y

    1. Initial program 92.3%

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

      \[\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)} \]
    5. Step-by-step derivation
      1. +-commutative49.6%

        \[\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)} \]
    6. Simplified84.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 9.8 \cdot 10^{-157}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{-54}:\\ \;\;\;\;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 4: 72.8% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 10^{-156}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+138}:\\ \;\;\;\;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} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y 1e-156)
   x
   (if (<= y 6.5e+138) (+ x (* (tanh (/ t y)) (* y z))) (+ x (* z (- t x))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 1e-156) {
		tmp = x;
	} else if (y <= 6.5e+138) {
		tmp = x + (tanh((t / y)) * (y * z));
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= 1d-156) then
        tmp = x
    else if (y <= 6.5d+138) then
        tmp = x + (tanh((t / y)) * (y * z))
    else
        tmp = x + (z * (t - x))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 1e-156) {
		tmp = x;
	} else if (y <= 6.5e+138) {
		tmp = x + (Math.tanh((t / y)) * (y * z));
	} else {
		tmp = x + (z * (t - x));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= 1e-156:
		tmp = x
	elif y <= 6.5e+138:
		tmp = x + (math.tanh((t / y)) * (y * z))
	else:
		tmp = x + (z * (t - x))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 1e-156)
		tmp = x;
	elseif (y <= 6.5e+138)
		tmp = Float64(x + Float64(tanh(Float64(t / y)) * Float64(y * z)));
	else
		tmp = Float64(x + Float64(z * Float64(t - x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= 1e-156)
		tmp = x;
	elseif (y <= 6.5e+138)
		tmp = x + (tanh((t / y)) * (y * z));
	else
		tmp = x + (z * (t - x));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, 1e-156], x, If[LessEqual[y, 6.5e+138], 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}

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

\mathbf{elif}\;y \leq 6.5 \cdot 10^{+138}:\\
\;\;\;\;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 3 regimes
  2. if y < 1.00000000000000004e-156

    1. Initial program 95.5%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Step-by-step derivation
      1. 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. Taylor expanded in y around inf 56.5%

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

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

    if 1.00000000000000004e-156 < y < 6.50000000000000054e138

    1. Initial program 99.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*98.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. Simplified98.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 28.2%

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

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

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

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

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

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

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

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

    if 6.50000000000000054e138 < y

    1. Initial program 82.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*92.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. Simplified92.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. Taylor expanded in y around inf 93.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 10^{-156}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+138}:\\ \;\;\;\;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 5: 69.2% accurate, 23.5× speedup?

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

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

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


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

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

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

      \[\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 y around inf 56.7%

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

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

    if 4.6e9 < y

    1. Initial program 90.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*93.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. Simplified93.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 y around inf 78.8%

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

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

Alternative 6: 62.6% accurate, 30.2× speedup?

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

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

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


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

    1. Initial program 96.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.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. Simplified98.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 y around inf 56.1%

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

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

    if 1.8499999999999999e-52 < y

    1. Initial program 92.3%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Step-by-step derivation
      1. associate-*l*95.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. Simplified95.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 y around inf 75.8%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.85 \cdot 10^{-52}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \end{array} \]

Alternative 7: 62.5% accurate, 30.2× speedup?

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

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

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


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

    1. Initial program 97.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*99.1%

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

      \[\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 y around inf 59.5%

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

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

    if 4.7000000000000001e107 < z

    1. Initial program 82.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*92.2%

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

      \[\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 y around inf 69.1%

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

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

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

Alternative 8: 65.8% accurate, 30.2× speedup?

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

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

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


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

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

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

      \[\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 y around inf 56.9%

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

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

    if 9.5e15 < y

    1. Initial program 89.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*93.6%

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

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

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

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

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

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

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

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

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

Alternative 9: 59.7% accurate, 35.1× speedup?

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

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

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


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

    1. Initial program 95.5%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Step-by-step derivation
      1. associate-*l*98.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. Simplified98.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 y around inf 59.5%

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

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

    if 2.5000000000000002e171 < z

    1. Initial program 89.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*94.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. Simplified94.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. Taylor expanded in y around inf 79.4%

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

        \[\leadsto x + y \cdot \color{blue}{\frac{z}{\frac{y}{t - x}}} \]
    6. Simplified74.2%

      \[\leadsto x + y \cdot \color{blue}{\frac{z}{\frac{y}{t - x}}} \]
    7. Taylor expanded in t around 0 44.4%

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

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

        \[\leadsto x + y \cdot \left(-\color{blue}{\frac{x}{\frac{y}{z}}}\right) \]
      3. distribute-neg-frac43.8%

        \[\leadsto x + y \cdot \color{blue}{\frac{-x}{\frac{y}{z}}} \]
    9. Simplified43.8%

      \[\leadsto x + y \cdot \color{blue}{\frac{-x}{\frac{y}{z}}} \]
    10. Step-by-step derivation
      1. distribute-frac-neg43.8%

        \[\leadsto x + y \cdot \color{blue}{\left(-\frac{x}{\frac{y}{z}}\right)} \]
      2. distribute-rgt-neg-out43.8%

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

        \[\leadsto x + \left(-y \cdot \color{blue}{\left(x \cdot \frac{1}{\frac{y}{z}}\right)}\right) \]
      4. add-sqr-sqrt27.5%

        \[\leadsto x + \left(-y \cdot \left(\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{1}{\frac{y}{z}}\right)\right) \]
      5. sqrt-unprod27.8%

        \[\leadsto x + \left(-y \cdot \left(\color{blue}{\sqrt{x \cdot x}} \cdot \frac{1}{\frac{y}{z}}\right)\right) \]
      6. sqr-neg27.8%

        \[\leadsto x + \left(-y \cdot \left(\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}} \cdot \frac{1}{\frac{y}{z}}\right)\right) \]
      7. sqrt-unprod0.4%

        \[\leadsto x + \left(-y \cdot \left(\color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)} \cdot \frac{1}{\frac{y}{z}}\right)\right) \]
      8. add-sqr-sqrt1.2%

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

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

        \[\leadsto x + \left(-\color{blue}{\left(y \cdot \left(-x\right)\right) \cdot \frac{z}{y}}\right) \]
      11. clear-num1.0%

        \[\leadsto x + \left(-\left(y \cdot \left(-x\right)\right) \cdot \color{blue}{\frac{1}{\frac{y}{z}}}\right) \]
      12. div-inv1.1%

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

        \[\leadsto x + \left(-\color{blue}{y \cdot \frac{-x}{\frac{y}{z}}}\right) \]
      14. sub-neg1.3%

        \[\leadsto \color{blue}{x - y \cdot \frac{-x}{\frac{y}{z}}} \]
      15. associate-*r/1.1%

        \[\leadsto x - \color{blue}{\frac{y \cdot \left(-x\right)}{\frac{y}{z}}} \]
      16. div-inv1.0%

        \[\leadsto x - \color{blue}{\left(y \cdot \left(-x\right)\right) \cdot \frac{1}{\frac{y}{z}}} \]
      17. clear-num1.0%

        \[\leadsto x - \left(y \cdot \left(-x\right)\right) \cdot \color{blue}{\frac{z}{y}} \]
      18. associate-*r*1.2%

        \[\leadsto x - \color{blue}{y \cdot \left(\left(-x\right) \cdot \frac{z}{y}\right)} \]
    11. Applied egg-rr43.6%

      \[\leadsto \color{blue}{x - y \cdot \left(x \cdot \frac{z}{y}\right)} \]
    12. Step-by-step derivation
      1. associate-*r/44.4%

        \[\leadsto x - y \cdot \color{blue}{\frac{x \cdot z}{y}} \]
      2. associate-*l/44.4%

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

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

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

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

        \[\leadsto \color{blue}{-x \cdot z} \]
      2. *-commutative44.7%

        \[\leadsto -\color{blue}{z \cdot x} \]
      3. distribute-rgt-neg-in44.7%

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

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

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

Alternative 10: 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 95.1%

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

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

    \[\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 y around inf 61.0%

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

    \[\leadsto \color{blue}{x} \]
  6. Final simplification61.7%

    \[\leadsto x \]

Developer target: 97.3% 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 2023306 
(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))))))