SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.5% → 97.0%
Time: 13.8s
Alternatives: 15
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 15 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.5% 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.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \tanh \left(\frac{x}{y}\right) \cdot \left(-z\right)\right), y, x\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma (fma (tanh (/ t y)) z (* (tanh (/ x y)) (- z))) y x))
double code(double x, double y, double z, double t) {
	return fma(fma(tanh((t / y)), z, (tanh((x / y)) * -z)), y, x);
}
function code(x, y, z, t)
	return fma(fma(tanh(Float64(t / y)), z, Float64(tanh(Float64(x / y)) * Float64(-z))), y, x)
end
code[x_, y_, z_, t_] := N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * z + N[(N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision] * (-z)), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \tanh \left(\frac{x}{y}\right) \cdot \left(-z\right)\right), y, x\right)
\end{array}
Derivation
  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. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto x + \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. lift-/.f64N/A

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \]
    3. lift-tanh.f64N/A

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\color{blue}{\tanh \left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \]
    4. lift-/.f64N/A

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \color{blue}{\left(\frac{x}{y}\right)}\right) \]
    5. lift-tanh.f64N/A

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\tanh \left(\frac{x}{y}\right)}\right) \]
    6. lift--.f64N/A

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
    7. lift-*.f64N/A

      \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
    8. +-commutativeN/A

      \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) + x} \]
    9. lift-*.f64N/A

      \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} + x \]
    10. lift-*.f64N/A

      \[\leadsto \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) + x \]
    11. associate-*l*N/A

      \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} + x \]
    12. *-commutativeN/A

      \[\leadsto \color{blue}{\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot y} + x \]
    13. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), y, x\right)} \]
    14. lower-*.f6497.9

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), y, x\right)} \]
  5. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \mathsf{fma}\left(z \cdot \left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right), y, x\right) \]
    2. lift-tanh.f64N/A

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

      \[\leadsto \mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \color{blue}{\left(\frac{x}{y}\right)}\right), y, x\right) \]
    4. lift-tanh.f64N/A

      \[\leadsto \mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\tanh \left(\frac{x}{y}\right)}\right), y, x\right) \]
    5. sub-negN/A

      \[\leadsto \mathsf{fma}\left(z \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) + \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right)\right)}, y, x\right) \]
    6. distribute-rgt-inN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\tanh \left(\frac{t}{y}\right) \cdot z + \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot z}, y, x\right) \]
    7. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot z\right)}, y, x\right) \]
    8. lower-*.f64N/A

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

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

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

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

Alternative 2: 97.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), y, x\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma (* z (- (tanh (/ t y)) (tanh (/ x y)))) y x))
double code(double x, double y, double z, double t) {
	return fma((z * (tanh((t / y)) - tanh((x / y)))), y, x);
}
function code(x, y, z, t)
	return fma(Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), y, x)
end
code[x_, y_, z_, t_] := N[(N[(z * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), y, x\right)
\end{array}
Derivation
  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. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto x + \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. lift-/.f64N/A

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \]
    3. lift-tanh.f64N/A

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\color{blue}{\tanh \left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \]
    4. lift-/.f64N/A

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \color{blue}{\left(\frac{x}{y}\right)}\right) \]
    5. lift-tanh.f64N/A

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\tanh \left(\frac{x}{y}\right)}\right) \]
    6. lift--.f64N/A

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
    7. lift-*.f64N/A

      \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
    8. +-commutativeN/A

      \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) + x} \]
    9. lift-*.f64N/A

      \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} + x \]
    10. lift-*.f64N/A

      \[\leadsto \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) + x \]
    11. associate-*l*N/A

      \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} + x \]
    12. *-commutativeN/A

      \[\leadsto \color{blue}{\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot y} + x \]
    13. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), y, x\right)} \]
    14. lower-*.f6497.9

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

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

Alternative 3: 78.7% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{-1}{\frac{-1 - \frac{x + \frac{x \cdot x}{t}}{t}}{t}}, x\right)\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 7.6 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \frac{z \cdot \left(-x\right)}{y}\right), y, x\right)\\

\mathbf{elif}\;x \leq 4 \cdot 10^{+197}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right), y, x\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.7999999999999999e23 or 3.9999999999999998e197 < x

    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. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6464.3

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified64.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
    6. Step-by-step derivation
      1. flip--N/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{t \cdot t - x \cdot x}{t + x}}, x\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      3. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      5. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\color{blue}{t + x}}{t \cdot t - x \cdot x}}, x\right) \]
      6. difference-of-squaresN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
      7. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\left(t + x\right) \cdot \color{blue}{\left(t - x\right)}}}, x\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
      9. lower-+.f6427.2

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right)} \cdot \left(t - x\right)}}, x\right) \]
    7. Applied egg-rr27.2%

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
    8. Taylor expanded in t around -inf

      \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{t}}}, x\right) \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\mathsf{neg}\left(\frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{t}\right)}}, x\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{\mathsf{neg}\left(t\right)}}}, x\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{\color{blue}{-1 \cdot t}}}, x\right) \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{-1 \cdot t}}}, x\right) \]
    10. Simplified82.0%

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

    if -1.7999999999999999e23 < x < 7.5999999999999996e-11

    1. Initial program 91.8%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \]
      3. lift-tanh.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\color{blue}{\tanh \left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \]
      4. lift-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \color{blue}{\left(\frac{x}{y}\right)}\right) \]
      5. lift-tanh.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\tanh \left(\frac{x}{y}\right)}\right) \]
      6. lift--.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      7. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      8. +-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) + x} \]
      9. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} + x \]
      10. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) + x \]
      11. associate-*l*N/A

        \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} + x \]
      12. *-commutativeN/A

        \[\leadsto \color{blue}{\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot y} + x \]
      13. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), y, x\right)} \]
      14. lower-*.f6496.0

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), y, x\right)} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z \cdot \left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right), y, x\right) \]
      2. lift-tanh.f64N/A

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

        \[\leadsto \mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \color{blue}{\left(\frac{x}{y}\right)}\right), y, x\right) \]
      4. lift-tanh.f64N/A

        \[\leadsto \mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\tanh \left(\frac{x}{y}\right)}\right), y, x\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{fma}\left(z \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) + \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right)\right)}, y, x\right) \]
      6. distribute-rgt-inN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\tanh \left(\frac{t}{y}\right) \cdot z + \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot z}, y, x\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot z\right)}, y, x\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \color{blue}{\left(\mathsf{neg}\left(\tanh \left(\frac{x}{y}\right)\right)\right) \cdot z}\right), y, x\right) \]
      9. lower-neg.f6496.0

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

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

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \color{blue}{-1 \cdot \frac{x \cdot z}{y}}\right), y, x\right) \]
    8. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \color{blue}{\frac{-1 \cdot \left(x \cdot z\right)}{y}}\right), y, x\right) \]
      2. lower-/.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \frac{\color{blue}{\mathsf{neg}\left(x \cdot z\right)}}{y}\right), y, x\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \frac{\mathsf{neg}\left(\color{blue}{z \cdot x}\right)}{y}\right), y, x\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \frac{\color{blue}{z \cdot \left(\mathsf{neg}\left(x\right)\right)}}{y}\right), y, x\right) \]
      6. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \frac{z \cdot \color{blue}{\left(-1 \cdot x\right)}}{y}\right), y, x\right) \]
      7. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \frac{\color{blue}{z \cdot \left(-1 \cdot x\right)}}{y}\right), y, x\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), z, \frac{z \cdot \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}}{y}\right), y, x\right) \]
      9. lower-neg.f6484.5

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

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

    if 7.5999999999999996e-11 < x < 3.9999999999999998e197

    1. Initial program 94.5%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \]
      3. lift-tanh.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\color{blue}{\tanh \left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \]
      4. lift-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \color{blue}{\left(\frac{x}{y}\right)}\right) \]
      5. lift-tanh.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\tanh \left(\frac{x}{y}\right)}\right) \]
      6. lift--.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      7. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      8. +-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) + x} \]
      9. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} + x \]
      10. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) + x \]
      11. associate-*l*N/A

        \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} + x \]
      12. *-commutativeN/A

        \[\leadsto \color{blue}{\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot y} + x \]
      13. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), y, x\right)} \]
      14. lower-*.f6499.9

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

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

      \[\leadsto \mathsf{fma}\left(z \cdot \left(\color{blue}{\frac{t}{y}} - \tanh \left(\frac{x}{y}\right)\right), y, x\right) \]
    6. Step-by-step derivation
      1. lower-/.f6485.7

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

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

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

Alternative 4: 78.0% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{-1}{\frac{-1 - \frac{x + \frac{x \cdot x}{t}}{t}}{t}}, x\right)\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 5 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right), y, x\right)\\

\mathbf{elif}\;x \leq 4 \cdot 10^{+197}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right), y, x\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.7999999999999999e23 or 3.9999999999999998e197 < x

    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. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6464.3

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified64.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
    6. Step-by-step derivation
      1. flip--N/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{t \cdot t - x \cdot x}{t + x}}, x\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      3. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      5. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\color{blue}{t + x}}{t \cdot t - x \cdot x}}, x\right) \]
      6. difference-of-squaresN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
      7. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\left(t + x\right) \cdot \color{blue}{\left(t - x\right)}}}, x\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
      9. lower-+.f6427.2

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right)} \cdot \left(t - x\right)}}, x\right) \]
    7. Applied egg-rr27.2%

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
    8. Taylor expanded in t around -inf

      \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{t}}}, x\right) \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\mathsf{neg}\left(\frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{t}\right)}}, x\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{\mathsf{neg}\left(t\right)}}}, x\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{\color{blue}{-1 \cdot t}}}, x\right) \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{-1 \cdot t}}}, x\right) \]
    10. Simplified82.0%

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

    if -1.7999999999999999e23 < x < 4.9999999999999999e-13

    1. Initial program 92.5%

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

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

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\frac{x}{y}}\right) \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) \]
      2. lift-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \frac{x}{y}\right) \]
      3. lift-tanh.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\color{blue}{\tanh \left(\frac{t}{y}\right)} - \frac{x}{y}\right) \]
      4. lift-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\frac{x}{y}}\right) \]
      5. lift--.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)} \]
      6. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)} \]
      7. +-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) + x} \]
      8. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)} + x \]
      9. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) + x \]
      10. associate-*l*N/A

        \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)\right)} + x \]
      11. *-commutativeN/A

        \[\leadsto \color{blue}{\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)\right) \cdot y} + x \]
      12. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right), y, x\right)} \]
      13. lower-*.f6483.8

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

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

    if 4.9999999999999999e-13 < x < 3.9999999999999998e197

    1. Initial program 92.8%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
      2. lift-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \]
      3. lift-tanh.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\color{blue}{\tanh \left(\frac{t}{y}\right)} - \tanh \left(\frac{x}{y}\right)\right) \]
      4. lift-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \color{blue}{\left(\frac{x}{y}\right)}\right) \]
      5. lift-tanh.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\tanh \left(\frac{x}{y}\right)}\right) \]
      6. lift--.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      7. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      8. +-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) + x} \]
      9. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} + x \]
      10. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) + x \]
      11. associate-*l*N/A

        \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)} + x \]
      12. *-commutativeN/A

        \[\leadsto \color{blue}{\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \cdot y} + x \]
      13. lower-fma.f64N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(z \cdot \left(\color{blue}{\frac{t}{y}} - \tanh \left(\frac{x}{y}\right)\right), y, x\right) \]
    6. Step-by-step derivation
      1. lower-/.f6485.3

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

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

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

Alternative 5: 77.4% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{-1}{\frac{-1 - \frac{x + \frac{x \cdot x}{t}}{t}}{t}}, x\right)\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 1.32 \cdot 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right), y, x\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.7999999999999999e23 or 1.31999999999999995e163 < x

    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. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6463.2

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified63.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
    6. Step-by-step derivation
      1. flip--N/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{t \cdot t - x \cdot x}{t + x}}, x\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      3. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      5. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\color{blue}{t + x}}{t \cdot t - x \cdot x}}, x\right) \]
      6. difference-of-squaresN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
      7. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\left(t + x\right) \cdot \color{blue}{\left(t - x\right)}}}, x\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
      9. lower-+.f6426.2

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right)} \cdot \left(t - x\right)}}, x\right) \]
    7. Applied egg-rr26.2%

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
    8. Taylor expanded in t around -inf

      \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{t}}}, x\right) \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\mathsf{neg}\left(\frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{t}\right)}}, x\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{\mathsf{neg}\left(t\right)}}}, x\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{\color{blue}{-1 \cdot t}}}, x\right) \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{-1 \cdot \frac{\frac{{x}^{2}}{t} - -1 \cdot x}{t} - 1}{-1 \cdot t}}}, x\right) \]
    10. Simplified80.4%

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

    if -1.7999999999999999e23 < x < 1.31999999999999995e163

    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. Add Preprocessing
    3. Taylor expanded in x around 0

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

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\frac{x}{y}}\right) \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) \]
      2. lift-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \color{blue}{\left(\frac{t}{y}\right)} - \frac{x}{y}\right) \]
      3. lift-tanh.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\color{blue}{\tanh \left(\frac{t}{y}\right)} - \frac{x}{y}\right) \]
      4. lift-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\frac{x}{y}}\right) \]
      5. lift--.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)} \]
      6. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)} \]
      7. +-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) + x} \]
      8. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)} + x \]
      9. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot z\right)} \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) + x \]
      10. associate-*l*N/A

        \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)\right)} + x \]
      11. *-commutativeN/A

        \[\leadsto \color{blue}{\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)\right) \cdot y} + x \]
      12. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right), y, x\right)} \]
      13. lower-*.f6482.8

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

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

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

Alternative 6: 64.3% accurate, 3.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{-1}{\frac{1 + \frac{t + \frac{t \cdot t}{x}}{x}}{x}}, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\


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

    1. Initial program 97.8%

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

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6454.6

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified54.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
    6. Step-by-step derivation
      1. flip--N/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{t \cdot t - x \cdot x}{t + x}}, x\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      3. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      5. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\color{blue}{t + x}}{t \cdot t - x \cdot x}}, x\right) \]
      6. difference-of-squaresN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
      7. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\left(t + x\right) \cdot \color{blue}{\left(t - x\right)}}}, x\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
      9. lower-+.f6440.6

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right)} \cdot \left(t - x\right)}}, x\right) \]
    7. Applied egg-rr40.6%

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
    8. Taylor expanded in x around -inf

      \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{-1 \cdot \frac{1 + -1 \cdot \frac{-1 \cdot \frac{{t}^{2}}{x} - t}{x}}{x}}}, x\right) \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\mathsf{neg}\left(\frac{1 + -1 \cdot \frac{-1 \cdot \frac{{t}^{2}}{x} - t}{x}}{x}\right)}}, x\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{1 + -1 \cdot \frac{-1 \cdot \frac{{t}^{2}}{x} - t}{x}}{\mathsf{neg}\left(x\right)}}}, x\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{1 + -1 \cdot \frac{-1 \cdot \frac{{t}^{2}}{x} - t}{x}}{\color{blue}{-1 \cdot x}}}, x\right) \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{1 + -1 \cdot \frac{-1 \cdot \frac{{t}^{2}}{x} - t}{x}}{-1 \cdot x}}}, x\right) \]
    10. Simplified64.2%

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

    if 4.80000000000000031e-39 < y

    1. Initial program 86.9%

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

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6486.4

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified86.4%

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

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

Alternative 7: 61.6% accurate, 4.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{-1 - \frac{t}{x}}{x}}, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\


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

    1. Initial program 97.8%

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

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6454.6

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified54.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
    6. Step-by-step derivation
      1. flip--N/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{t \cdot t - x \cdot x}{t + x}}, x\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      3. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      4. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{t + x}{t \cdot t - x \cdot x}}}, x\right) \]
      5. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\color{blue}{t + x}}{t \cdot t - x \cdot x}}, x\right) \]
      6. difference-of-squaresN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
      7. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\left(t + x\right) \cdot \color{blue}{\left(t - x\right)}}}, x\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
      9. lower-+.f6440.6

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{t + x}{\color{blue}{\left(t + x\right)} \cdot \left(t - x\right)}}, x\right) \]
    7. Applied egg-rr40.6%

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{t + x}{\left(t + x\right) \cdot \left(t - x\right)}}}, x\right) \]
    8. Taylor expanded in x around inf

      \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{-1 \cdot \frac{t}{x} - 1}{x}}}, x\right) \]
    9. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\color{blue}{-1 \cdot \frac{t}{x} + \left(\mathsf{neg}\left(1\right)\right)}}{x}}, x\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\color{blue}{\left(\mathsf{neg}\left(\frac{t}{x}\right)\right)} + \left(\mathsf{neg}\left(1\right)\right)}{x}}, x\right) \]
      3. distribute-neg-inN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\color{blue}{\mathsf{neg}\left(\left(\frac{t}{x} + 1\right)\right)}}{x}}, x\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\mathsf{neg}\left(\color{blue}{\left(1 + \frac{t}{x}\right)}\right)}{x}}, x\right) \]
      5. distribute-neg-fracN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\mathsf{neg}\left(\frac{1 + \frac{t}{x}}{x}\right)}}, x\right) \]
      6. distribute-neg-frac2N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{1 + \frac{t}{x}}{\mathsf{neg}\left(x\right)}}}, x\right) \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{1 + \frac{t}{x}}{\color{blue}{-1 \cdot x}}}, x\right) \]
      8. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{1 + \frac{t}{x}}{-1 \cdot x}}}, x\right) \]
      9. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\color{blue}{1 + \frac{t}{x}}}{-1 \cdot x}}, x\right) \]
      10. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{1 + \color{blue}{\frac{t}{x}}}{-1 \cdot x}}, x\right) \]
      11. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{1 + \frac{t}{x}}{\color{blue}{\mathsf{neg}\left(x\right)}}}, x\right) \]
      12. lower-neg.f6461.0

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{1 + \frac{t}{x}}{\color{blue}{-x}}}, x\right) \]
    10. Simplified61.0%

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

    if 4.80000000000000031e-39 < y

    1. Initial program 86.9%

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

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6486.4

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified86.4%

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

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

Alternative 8: 57.3% accurate, 6.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{-1}, \frac{y \cdot x}{y}, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\


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

    1. Initial program 97.8%

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\frac{x}{y}}\right) \]
    4. Step-by-step derivation
      1. lower-/.f6464.9

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

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(-1 \cdot \frac{x}{y}\right)} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \]
      2. distribute-neg-frac2N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{\mathsf{neg}\left(y\right)}} \]
      3. mul-1-negN/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{x}{\color{blue}{-1 \cdot y}} \]
      4. lower-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{-1 \cdot y}} \]
      5. mul-1-negN/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{x}{\color{blue}{\mathsf{neg}\left(y\right)}} \]
      6. lower-neg.f6448.4

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{-y}} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right)} \cdot \frac{x}{\mathsf{neg}\left(y\right)} \]
      2. lift-neg.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{x}{\color{blue}{\mathsf{neg}\left(y\right)}} \]
      3. lift-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{\mathsf{neg}\left(y\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \frac{x}{\mathsf{neg}\left(y\right)}} \]
      5. +-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \frac{x}{\mathsf{neg}\left(y\right)} + x} \]
      6. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \frac{x}{\mathsf{neg}\left(y\right)}} + x \]
      7. lift-/.f64N/A

        \[\leadsto \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{\mathsf{neg}\left(y\right)}} + x \]
      8. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{\left(y \cdot z\right) \cdot x}{\mathsf{neg}\left(y\right)}} + x \]
      9. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{\left(y \cdot z\right)} \cdot x}{\mathsf{neg}\left(y\right)} + x \]
      10. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(z \cdot y\right)} \cdot x}{\mathsf{neg}\left(y\right)} + x \]
      11. associate-*l*N/A

        \[\leadsto \frac{\color{blue}{z \cdot \left(y \cdot x\right)}}{\mathsf{neg}\left(y\right)} + x \]
      12. lift-neg.f64N/A

        \[\leadsto \frac{z \cdot \left(y \cdot x\right)}{\color{blue}{\mathsf{neg}\left(y\right)}} + x \]
      13. neg-mul-1N/A

        \[\leadsto \frac{z \cdot \left(y \cdot x\right)}{\color{blue}{-1 \cdot y}} + x \]
      14. times-fracN/A

        \[\leadsto \color{blue}{\frac{z}{-1} \cdot \frac{y \cdot x}{y}} + x \]
      15. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z}{-1}, \frac{y \cdot x}{y}, x\right)} \]
      16. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{z}{-1}}, \frac{y \cdot x}{y}, x\right) \]
      17. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{z}{-1}, \color{blue}{\frac{y \cdot x}{y}}, x\right) \]
      18. lower-*.f6452.5

        \[\leadsto \mathsf{fma}\left(\frac{z}{-1}, \frac{\color{blue}{y \cdot x}}{y}, x\right) \]
    10. Applied egg-rr52.5%

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

    if 4.80000000000000031e-39 < y

    1. Initial program 86.9%

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

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6486.4

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified86.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 56.8% accurate, 7.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.5 \cdot 10^{-39}:\\
\;\;\;\;x - \frac{z \cdot \left(y \cdot x\right)}{y}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\


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

    1. Initial program 97.8%

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\frac{x}{y}}\right) \]
    4. Step-by-step derivation
      1. lower-/.f6464.9

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

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(-1 \cdot \frac{x}{y}\right)} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \]
      2. distribute-neg-frac2N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{\mathsf{neg}\left(y\right)}} \]
      3. mul-1-negN/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{x}{\color{blue}{-1 \cdot y}} \]
      4. lower-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{-1 \cdot y}} \]
      5. mul-1-negN/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{x}{\color{blue}{\mathsf{neg}\left(y\right)}} \]
      6. lower-neg.f6448.4

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{-y}} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right)} \cdot \frac{x}{\mathsf{neg}\left(y\right)} \]
      2. lift-neg.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{x}{\color{blue}{\mathsf{neg}\left(y\right)}} \]
      3. lift-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{\mathsf{neg}\left(y\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \frac{x}{\mathsf{neg}\left(y\right)}} \]
      5. +-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \frac{x}{\mathsf{neg}\left(y\right)} + x} \]
      6. lower-+.f6448.4

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \frac{x}{-y} + x} \]
      7. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \frac{x}{\mathsf{neg}\left(y\right)}} + x \]
      8. lift-/.f64N/A

        \[\leadsto \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{\mathsf{neg}\left(y\right)}} + x \]
      9. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{\left(y \cdot z\right) \cdot x}{\mathsf{neg}\left(y\right)}} + x \]
      10. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(y \cdot z\right) \cdot x}{\mathsf{neg}\left(y\right)}} + x \]
      11. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{\left(y \cdot z\right)} \cdot x}{\mathsf{neg}\left(y\right)} + x \]
      12. associate-*l*N/A

        \[\leadsto \frac{\color{blue}{y \cdot \left(z \cdot x\right)}}{\mathsf{neg}\left(y\right)} + x \]
      13. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot \left(z \cdot x\right)}}{\mathsf{neg}\left(y\right)} + x \]
      14. lower-*.f6454.2

        \[\leadsto \frac{y \cdot \color{blue}{\left(z \cdot x\right)}}{-y} + x \]
    10. Applied egg-rr54.2%

      \[\leadsto \color{blue}{\frac{y \cdot \left(z \cdot x\right)}{-y} + x} \]
    11. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{y \cdot \color{blue}{\left(x \cdot z\right)}}{\mathsf{neg}\left(y\right)} + x \]
      2. associate-*r*N/A

        \[\leadsto \frac{\color{blue}{\left(y \cdot x\right) \cdot z}}{\mathsf{neg}\left(y\right)} + x \]
      3. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{\left(y \cdot x\right) \cdot z}}{\mathsf{neg}\left(y\right)} + x \]
      4. lower-*.f6452.0

        \[\leadsto \frac{\color{blue}{\left(y \cdot x\right)} \cdot z}{-y} + x \]
    12. Applied egg-rr52.0%

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

    if 3.5e-39 < y

    1. Initial program 86.9%

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

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6486.4

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified86.4%

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

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

Alternative 10: 57.7% accurate, 7.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.5 \cdot 10^{-39}:\\
\;\;\;\;x - \frac{y \cdot \left(z \cdot x\right)}{y}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\


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

    1. Initial program 97.8%

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\frac{x}{y}}\right) \]
    4. Step-by-step derivation
      1. lower-/.f6464.9

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

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(-1 \cdot \frac{x}{y}\right)} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \]
      2. distribute-neg-frac2N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{\mathsf{neg}\left(y\right)}} \]
      3. mul-1-negN/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{x}{\color{blue}{-1 \cdot y}} \]
      4. lower-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{-1 \cdot y}} \]
      5. mul-1-negN/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{x}{\color{blue}{\mathsf{neg}\left(y\right)}} \]
      6. lower-neg.f6448.4

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{-y}} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right)} \cdot \frac{x}{\mathsf{neg}\left(y\right)} \]
      2. lift-neg.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{x}{\color{blue}{\mathsf{neg}\left(y\right)}} \]
      3. lift-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{\mathsf{neg}\left(y\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto x + \color{blue}{\left(y \cdot z\right) \cdot \frac{x}{\mathsf{neg}\left(y\right)}} \]
      5. +-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \frac{x}{\mathsf{neg}\left(y\right)} + x} \]
      6. lower-+.f6448.4

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \frac{x}{-y} + x} \]
      7. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot \frac{x}{\mathsf{neg}\left(y\right)}} + x \]
      8. lift-/.f64N/A

        \[\leadsto \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{\mathsf{neg}\left(y\right)}} + x \]
      9. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{\left(y \cdot z\right) \cdot x}{\mathsf{neg}\left(y\right)}} + x \]
      10. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(y \cdot z\right) \cdot x}{\mathsf{neg}\left(y\right)}} + x \]
      11. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{\left(y \cdot z\right)} \cdot x}{\mathsf{neg}\left(y\right)} + x \]
      12. associate-*l*N/A

        \[\leadsto \frac{\color{blue}{y \cdot \left(z \cdot x\right)}}{\mathsf{neg}\left(y\right)} + x \]
      13. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot \left(z \cdot x\right)}}{\mathsf{neg}\left(y\right)} + x \]
      14. lower-*.f6454.2

        \[\leadsto \frac{y \cdot \color{blue}{\left(z \cdot x\right)}}{-y} + x \]
    10. Applied egg-rr54.2%

      \[\leadsto \color{blue}{\frac{y \cdot \left(z \cdot x\right)}{-y} + x} \]
    11. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{y \cdot \color{blue}{\left(z \cdot x\right)}}{\mathsf{neg}\left(y\right)} + x \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot \left(z \cdot x\right)}}{\mathsf{neg}\left(y\right)} + x \]
      3. lift-neg.f64N/A

        \[\leadsto \frac{y \cdot \left(z \cdot x\right)}{\color{blue}{\mathsf{neg}\left(y\right)}} + x \]
      4. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(z \cdot x\right)}{\mathsf{neg}\left(y\right)}} + x \]
      5. +-commutativeN/A

        \[\leadsto \color{blue}{x + \frac{y \cdot \left(z \cdot x\right)}{\mathsf{neg}\left(y\right)}} \]
      6. lift-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot \left(z \cdot x\right)}{\mathsf{neg}\left(y\right)}} \]
      7. lift-neg.f64N/A

        \[\leadsto x + \frac{y \cdot \left(z \cdot x\right)}{\color{blue}{\mathsf{neg}\left(y\right)}} \]
      8. distribute-frac-neg2N/A

        \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(\frac{y \cdot \left(z \cdot x\right)}{y}\right)\right)} \]
      9. unsub-negN/A

        \[\leadsto \color{blue}{x - \frac{y \cdot \left(z \cdot x\right)}{y}} \]
      10. lower--.f64N/A

        \[\leadsto \color{blue}{x - \frac{y \cdot \left(z \cdot x\right)}{y}} \]
      11. lower-/.f6454.2

        \[\leadsto x - \color{blue}{\frac{y \cdot \left(z \cdot x\right)}{y}} \]
    12. Applied egg-rr54.2%

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

    if 3.5e-39 < y

    1. Initial program 86.9%

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

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6486.4

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified86.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 61.6% accurate, 11.4× speedup?

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

\\
\begin{array}{l}
t_1 := z \cdot \left(t - x\right)\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 4500000000:\\
\;\;\;\;\mathsf{fma}\left(z, -x, x\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.8000000000000001e-19 or 4.5e9 < z

    1. Initial program 90.9%

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

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6446.2

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified46.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
    6. Taylor expanded in z around inf

      \[\leadsto \color{blue}{z \cdot \left(t - x\right)} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right)} \]
      2. lower--.f6445.9

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

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

    if -1.8000000000000001e-19 < z < 4.5e9

    1. Initial program 98.5%

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

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6481.1

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified81.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
    6. Taylor expanded in t around 0

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{-1 \cdot x}, x\right) \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\mathsf{neg}\left(x\right)}, x\right) \]
      2. lower-neg.f6487.9

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{-x}, x\right) \]
    8. Simplified87.9%

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{-x}, x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 19.8% accurate, 11.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5:\\
\;\;\;\;t \cdot z\\

\mathbf{elif}\;t \leq 6 \cdot 10^{-70}:\\
\;\;\;\;z \cdot \left(-x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.5 or 6.0000000000000003e-70 < t

    1. Initial program 94.4%

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

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6453.8

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified53.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
    6. Taylor expanded in t around inf

      \[\leadsto \color{blue}{t \cdot z} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{z \cdot t} \]
      2. lower-*.f6424.9

        \[\leadsto \color{blue}{z \cdot t} \]
    8. Simplified24.9%

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

    if -4.5 < t < 6.0000000000000003e-70

    1. Initial program 95.2%

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\frac{x}{y}}\right) \]
    4. Step-by-step derivation
      1. lower-/.f6470.3

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

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

      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(-1 \cdot \frac{x}{y}\right)} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)} \]
      2. distribute-neg-frac2N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{\mathsf{neg}\left(y\right)}} \]
      3. mul-1-negN/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{x}{\color{blue}{-1 \cdot y}} \]
      4. lower-/.f64N/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{x}{-1 \cdot y}} \]
      5. mul-1-negN/A

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{x}{\color{blue}{\mathsf{neg}\left(y\right)}} \]
      6. lower-neg.f6465.0

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot z\right)} \]
    10. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot z\right)} \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{z \cdot x}\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{z \cdot \left(\mathsf{neg}\left(x\right)\right)} \]
      4. mul-1-negN/A

        \[\leadsto z \cdot \color{blue}{\left(-1 \cdot x\right)} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{z \cdot \left(-1 \cdot x\right)} \]
      6. mul-1-negN/A

        \[\leadsto z \cdot \color{blue}{\left(\mathsf{neg}\left(x\right)\right)} \]
      7. lower-neg.f6423.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.5:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;t \leq 6 \cdot 10^{-70}:\\ \;\;\;\;z \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 59.0% accurate, 14.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 4.8 \cdot 10^{-39}:\\ \;\;\;\;\mathsf{fma}\left(z, -x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y 4.8e-39) (fma z (- x) x) (fma z (- t x) x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 4.8e-39) {
		tmp = fma(z, -x, x);
	} else {
		tmp = fma(z, (t - x), x);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 4.8e-39)
		tmp = fma(z, Float64(-x), x);
	else
		tmp = fma(z, Float64(t - x), x);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[y, 4.8e-39], N[(z * (-x) + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(z, -x, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\


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

    1. Initial program 97.8%

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

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6454.6

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified54.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
    6. Taylor expanded in t around 0

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{-1 \cdot x}, x\right) \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\mathsf{neg}\left(x\right)}, x\right) \]
      2. lower-neg.f6455.5

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{-x}, x\right) \]
    8. Simplified55.5%

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{-x}, x\right) \]

    if 4.80000000000000031e-39 < y

    1. Initial program 86.9%

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

      \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
      3. lower--.f6486.4

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
    5. Simplified86.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 25.9% accurate, 26.6× speedup?

\[\begin{array}{l} \\ z \cdot \left(t - x\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (* z (- t x)))
double code(double x, double y, double z, double t) {
	return z * (t - 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 = z * (t - x)
end function
public static double code(double x, double y, double z, double t) {
	return z * (t - x);
}
def code(x, y, z, t):
	return z * (t - x)
function code(x, y, z, t)
	return Float64(z * Float64(t - x))
end
function tmp = code(x, y, z, t)
	tmp = z * (t - x);
end
code[x_, y_, z_, t_] := N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
z \cdot \left(t - x\right)
\end{array}
Derivation
  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. Add Preprocessing
  3. Taylor expanded in y around inf

    \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
    2. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
    3. lower--.f6463.7

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
  5. Simplified63.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
  6. Taylor expanded in z around inf

    \[\leadsto \color{blue}{z \cdot \left(t - x\right)} \]
  7. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \color{blue}{z \cdot \left(t - x\right)} \]
    2. lower--.f6427.6

      \[\leadsto z \cdot \color{blue}{\left(t - x\right)} \]
  8. Simplified27.6%

    \[\leadsto \color{blue}{z \cdot \left(t - x\right)} \]
  9. Add Preprocessing

Alternative 15: 16.6% accurate, 39.8× speedup?

\[\begin{array}{l} \\ t \cdot z \end{array} \]
(FPCore (x y z t) :precision binary64 (* t z))
double code(double x, double y, double z, double t) {
	return t * z;
}
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 = t * z
end function
public static double code(double x, double y, double z, double t) {
	return t * z;
}
def code(x, y, z, t):
	return t * z
function code(x, y, z, t)
	return Float64(t * z)
end
function tmp = code(x, y, z, t)
	tmp = t * z;
end
code[x_, y_, z_, t_] := N[(t * z), $MachinePrecision]
\begin{array}{l}

\\
t \cdot z
\end{array}
Derivation
  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. Add Preprocessing
  3. Taylor expanded in y around inf

    \[\leadsto \color{blue}{x + z \cdot \left(t - x\right)} \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{z \cdot \left(t - x\right) + x} \]
    2. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
    3. lower--.f6463.7

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
  5. Simplified63.7%

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
  6. Taylor expanded in t around inf

    \[\leadsto \color{blue}{t \cdot z} \]
  7. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \color{blue}{z \cdot t} \]
    2. lower-*.f6418.1

      \[\leadsto \color{blue}{z \cdot t} \]
  8. Simplified18.1%

    \[\leadsto \color{blue}{z \cdot t} \]
  9. Final simplification18.1%

    \[\leadsto t \cdot z \]
  10. Add Preprocessing

Developer Target 1: 97.0% 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 2024208 
(FPCore (x y z t)
  :name "SynthBasics:moogVCF from YampaSynth-0.2"
  :precision binary64

  :alt
  (! :herbie-platform default (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))))

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