SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.5% → 98.8%
Time: 13.2s
Alternatives: 11
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.00000000000000002e306

    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. 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. *-commutativeN/A

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

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

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

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

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

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

    if 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

    1. Initial program 22.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--.f64100.0

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

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

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

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

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

Alternative 2: 60.9% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.00000000000000002e306

    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 x + \left(y \cdot z\right) \cdot \color{blue}{\left(-1 \cdot \frac{\left(-1 \cdot t + -1 \cdot \frac{\left(-1 \cdot \frac{\left(\frac{-1}{2} \cdot {x}^{3} + \frac{1}{2} \cdot \left(\frac{-1}{3} \cdot {t}^{3} + \left(\frac{1}{2} \cdot {t}^{3} + t \cdot \left(-1 \cdot {t}^{2} + \frac{1}{2} \cdot {t}^{2}\right)\right)\right)\right) - \left(\frac{-1}{2} \cdot {t}^{3} + \frac{1}{2} \cdot \left(\frac{-1}{3} \cdot {x}^{3} + \left(\frac{1}{2} \cdot {x}^{3} + x \cdot \left(-1 \cdot {x}^{2} + \frac{1}{2} \cdot {x}^{2}\right)\right)\right)\right)}{y} + \frac{1}{2} \cdot \left(-1 \cdot {t}^{2} + {t}^{2}\right)\right) - \frac{1}{2} \cdot \left(-1 \cdot {x}^{2} + {x}^{2}\right)}{y}\right) - -1 \cdot x}{y}\right)} \]
    4. Simplified26.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{neg}\left(z \cdot \mathsf{fma}\left(\frac{1}{3}, \frac{t \cdot \left(t \cdot t\right)}{y \cdot y}, \color{blue}{\mathsf{neg}\left(t\right)}\right)\right)\right) \]
      16. lower-neg.f6439.5

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

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

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

        \[\leadsto \color{blue}{t \cdot z + x} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{z \cdot t} + x \]
      3. lower-fma.f6462.8

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

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

    if 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

    1. Initial program 22.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--.f64100.0

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

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

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

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

Alternative 3: 79.7% accurate, 1.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.8000000000000002e26 or 3.5e21 < x

    1. Initial program 96.7%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

    if -3.8000000000000002e26 < x < 3.5e21

    1. Initial program 88.2%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

Alternative 4: 66.3% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3.6 \cdot 10^{-97}:\\ \;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{-1 - \frac{\frac{t \cdot t}{x}}{x}}{x}}, x\right)\\ \mathbf{elif}\;y \leq 4.05 \cdot 10^{+114}:\\ \;\;\;\;\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right), z, 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 3.6e-97)
   (fma z (/ 1.0 (/ (- -1.0 (/ (/ (* t t) x) x)) x)) x)
   (if (<= y 4.05e+114)
     (fma (* y (- (tanh (/ t y)) (/ x y))) z x)
     (fma z (- t x) x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 3.6e-97) {
		tmp = fma(z, (1.0 / ((-1.0 - (((t * t) / x) / x)) / x)), x);
	} else if (y <= 4.05e+114) {
		tmp = fma((y * (tanh((t / y)) - (x / y))), z, x);
	} else {
		tmp = fma(z, (t - x), x);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 3.6e-97)
		tmp = fma(z, Float64(1.0 / Float64(Float64(-1.0 - Float64(Float64(Float64(t * t) / x) / x)) / x)), x);
	elseif (y <= 4.05e+114)
		tmp = fma(Float64(y * Float64(tanh(Float64(t / y)) - Float64(x / y))), z, x);
	else
		tmp = fma(z, Float64(t - x), x);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[y, 3.6e-97], N[(z * N[(1.0 / N[(N[(-1.0 - N[(N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 4.05e+114], N[(N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 92.6%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. 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--.f6460.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\right)}{\color{blue}{\mathsf{fma}\left(t, t, x \cdot x + t \cdot x\right)} \cdot \left(t - x\right)}}, x\right) \]
      14. distribute-rgt-outN/A

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\right)}{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.59999999999999997e-97 < y < 4.0500000000000001e114

    1. Initial program 100.0%

      \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

    if 4.0500000000000001e114 < y

    1. Initial program 78.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--.f6497.1

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

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

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

Alternative 5: 63.1% accurate, 3.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3.3 \cdot 10^{+22}:\\ \;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{-1 - \frac{\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 3.3e+22)
   (fma z (/ 1.0 (/ (- -1.0 (/ (/ (* 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 <= 3.3e+22) {
		tmp = fma(z, (1.0 / ((-1.0 - (((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 <= 3.3e+22)
		tmp = fma(z, Float64(1.0 / Float64(Float64(-1.0 - Float64(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, 3.3e+22], N[(z * N[(1.0 / N[(N[(-1.0 - N[(N[(N[(t * t), $MachinePrecision] / x), $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 3.3 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{-1 - \frac{\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 < 3.2999999999999998e22

    1. Initial program 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\right)}{\color{blue}{\mathsf{fma}\left(t, t, x \cdot x + t \cdot x\right)} \cdot \left(t - x\right)}}, x\right) \]
      14. distribute-rgt-outN/A

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\right)}{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.2999999999999998e22 < y

    1. Initial program 86.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 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--.f6482.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.3 \cdot 10^{+22}:\\ \;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{-1 - \frac{\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 6: 61.9% accurate, 3.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.35 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 + \frac{\mathsf{fma}\left(t, \frac{t}{-x}, -t\right)}{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 < 1.35e-50

    1. Initial program 93.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 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--.f6459.9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\right)}{\color{blue}{\mathsf{fma}\left(t, t, x \cdot x + t \cdot x\right)} \cdot \left(t - x\right)}}, x\right) \]
      14. distribute-rgt-outN/A

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\right)}{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\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. sub-negN/A

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \frac{1}{\color{blue}{\frac{1 - \frac{\left(-t\right) - \frac{t \cdot t}{x}}{x}}{-x}}}, x\right) \]
    11. Applied egg-rr60.0%

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

    if 1.35e-50 < y

    1. Initial program 88.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--.f6478.3

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

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

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

Alternative 7: 60.9% accurate, 4.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 6.5 \cdot 10^{-188}:\\ \;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{-1 - \frac{t}{x}}{x}}, x\right)\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{+61}:\\ \;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{1 + \frac{x}{t}}{t}}, 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 6.5e-188)
   (fma z (/ 1.0 (/ (- -1.0 (/ t x)) x)) x)
   (if (<= y 1.75e+61)
     (fma z (/ 1.0 (/ (+ 1.0 (/ x t)) t)) x)
     (fma z (- t x) x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 6.5e-188) {
		tmp = fma(z, (1.0 / ((-1.0 - (t / x)) / x)), x);
	} else if (y <= 1.75e+61) {
		tmp = fma(z, (1.0 / ((1.0 + (x / t)) / t)), x);
	} else {
		tmp = fma(z, (t - x), x);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 6.5e-188)
		tmp = fma(z, Float64(1.0 / Float64(Float64(-1.0 - Float64(t / x)) / x)), x);
	elseif (y <= 1.75e+61)
		tmp = fma(z, Float64(1.0 / Float64(Float64(1.0 + Float64(x / t)) / t)), x);
	else
		tmp = fma(z, Float64(t - x), x);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[y, 6.5e-188], N[(z * N[(1.0 / N[(N[(-1.0 - N[(t / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 1.75e+61], N[(z * N[(1.0 / N[(N[(1.0 + N[(x / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.75 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{1 + \frac{x}{t}}{t}}, x\right)\\

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


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

    1. Initial program 91.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\right)}{\color{blue}{\mathsf{fma}\left(t, t, x \cdot x + t \cdot x\right)} \cdot \left(t - x\right)}}, x\right) \]
      14. distribute-rgt-outN/A

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\right)}{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\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. lower-neg.f64N/A

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

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

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

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

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

    if 6.4999999999999998e-188 < y < 1.75000000000000009e61

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\right)}{\color{blue}{\mathsf{fma}\left(t, t, x \cdot x + t \cdot x\right)} \cdot \left(t - x\right)}}, x\right) \]
      14. distribute-rgt-outN/A

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

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

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

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

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

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

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

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

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

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

    if 1.75000000000000009e61 < y

    1. Initial program 84.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--.f6483.6

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

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

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

Alternative 8: 62.3% accurate, 4.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 7.4 \cdot 10^{+63}:\\ \;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{1 + \frac{x}{t}}{t}}, 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 7.4e+63) (fma z (/ 1.0 (/ (+ 1.0 (/ x t)) t)) x) (fma z (- t x) x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 7.4e+63) {
		tmp = fma(z, (1.0 / ((1.0 + (x / t)) / t)), x);
	} else {
		tmp = fma(z, (t - x), x);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 7.4e+63)
		tmp = fma(z, Float64(1.0 / Float64(Float64(1.0 + Float64(x / t)) / t)), x);
	else
		tmp = fma(z, Float64(t - x), x);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[y, 7.4e+63], N[(z * N[(1.0 / N[(N[(1.0 + N[(x / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.4 \cdot 10^{+63}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{1 + \frac{x}{t}}{t}}, 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 < 7.39999999999999937e63

    1. Initial program 93.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--.f6460.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{\mathsf{fma}\left(t, t, x \cdot \left(t + x\right)\right)}{\color{blue}{\mathsf{fma}\left(t, t, x \cdot x + t \cdot x\right)} \cdot \left(t - x\right)}}, x\right) \]
      14. distribute-rgt-outN/A

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

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

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

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

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

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

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

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

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

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

    if 7.39999999999999937e63 < y

    1. Initial program 84.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--.f6483.6

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

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

Alternative 9: 58.4% accurate, 10.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 6.8 \cdot 10^{-190}:\\ \;\;\;\;\mathsf{fma}\left(z, -x, x\right)\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(z, t, 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 6.8e-190)
   (fma z (- x) x)
   (if (<= y 5.5e-5) (fma z t x) (fma z (- t x) x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 6.8e-190) {
		tmp = fma(z, -x, x);
	} else if (y <= 5.5e-5) {
		tmp = fma(z, t, x);
	} else {
		tmp = fma(z, (t - x), x);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (y <= 6.8e-190)
		tmp = fma(z, Float64(-x), x);
	elseif (y <= 5.5e-5)
		tmp = fma(z, t, x);
	else
		tmp = fma(z, Float64(t - x), x);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[y, 6.8e-190], N[(z * (-x) + x), $MachinePrecision], If[LessEqual[y, 5.5e-5], N[(z * t + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    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. 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--.f6462.2

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

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

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

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

    if 6.79999999999999963e-190 < y < 5.5000000000000002e-5

    1. Initial program 100.0%

      \[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 x + \left(y \cdot z\right) \cdot \color{blue}{\left(-1 \cdot \frac{\left(-1 \cdot t + -1 \cdot \frac{\left(-1 \cdot \frac{\left(\frac{-1}{2} \cdot {x}^{3} + \frac{1}{2} \cdot \left(\frac{-1}{3} \cdot {t}^{3} + \left(\frac{1}{2} \cdot {t}^{3} + t \cdot \left(-1 \cdot {t}^{2} + \frac{1}{2} \cdot {t}^{2}\right)\right)\right)\right) - \left(\frac{-1}{2} \cdot {t}^{3} + \frac{1}{2} \cdot \left(\frac{-1}{3} \cdot {x}^{3} + \left(\frac{1}{2} \cdot {x}^{3} + x \cdot \left(-1 \cdot {x}^{2} + \frac{1}{2} \cdot {x}^{2}\right)\right)\right)\right)}{y} + \frac{1}{2} \cdot \left(-1 \cdot {t}^{2} + {t}^{2}\right)\right) - \frac{1}{2} \cdot \left(-1 \cdot {x}^{2} + {x}^{2}\right)}{y}\right) - -1 \cdot x}{y}\right)} \]
    4. Simplified21.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{neg}\left(z \cdot \mathsf{fma}\left(\frac{1}{3}, \frac{t \cdot \left(t \cdot t\right)}{y \cdot y}, \color{blue}{\mathsf{neg}\left(t\right)}\right)\right)\right) \]
      16. lower-neg.f6439.8

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

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

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

        \[\leadsto \color{blue}{t \cdot z + x} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{z \cdot t} + x \]
      3. lower-fma.f6455.5

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

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

    if 5.5000000000000002e-5 < y

    1. Initial program 87.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 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--.f6483.4

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

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

Alternative 10: 57.8% accurate, 34.1× speedup?

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

\\
\mathsf{fma}\left(z, t, x\right)
\end{array}
Derivation
  1. Initial program 91.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot z + x} \]
    2. *-commutativeN/A

      \[\leadsto \color{blue}{z \cdot t} + x \]
    3. lower-fma.f6462.2

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, t, x\right)} \]
  11. Add Preprocessing

Alternative 11: 17.2% accurate, 39.8× speedup?

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

\\
z \cdot t
\end{array}
Derivation
  1. Initial program 91.9%

    \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
  2. 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.9

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

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

      \[\leadsto \color{blue}{z \cdot t} \]
  8. Simplified19.2%

    \[\leadsto \color{blue}{z \cdot t} \]
  9. Add Preprocessing

Developer Target 1: 97.2% 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 2024207 
(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))))))