SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.3% → 98.1%
Time: 11.0s
Alternatives: 14
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 14 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.3% 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.1% accurate, 0.5× speedup?

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

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

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


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

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

        \[\leadsto \color{blue}{x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
      2. +-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} \]
      3. 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 \]
      4. 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 \]
      5. associate-*l*N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot z, y, 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 40.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. *-commutativeN/A

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

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

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

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

      \[\leadsto z \cdot \color{blue}{\left(t - x\right)} \]
    7. Step-by-step derivation
      1. Applied rewrites100.0%

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

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

    Alternative 2: 71.3% accurate, 0.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t - x\right) \cdot z\\ t_2 := \frac{1}{\frac{\frac{\mathsf{fma}\left(y, x, \frac{\left(x \cdot x\right) \cdot y}{t}\right)}{t} + y}{t}} \cdot \left(z \cdot y\right) + x\\ t_3 := \tanh \left(\frac{x}{y}\right)\\ t_4 := x - \left(t\_3 - \tanh \left(\frac{t}{y}\right)\right) \cdot \left(z \cdot y\right)\\ \mathbf{if}\;t\_4 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_4 \leq -1 \cdot 10^{+31}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{-21}:\\ \;\;\;\;\frac{1}{\frac{\frac{\mathsf{fma}\left(t, \frac{y}{x} \cdot t, t \cdot y\right)}{x} + y}{-x}} \cdot \left(z \cdot y\right) + x\\ \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+135}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{t}{y} - t\_3\right) \cdot z, y, x\right)\\ \mathbf{elif}\;t\_4 \leq 10^{+306}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t)
     :precision binary64
     (let* ((t_1 (* (- t x) z))
            (t_2
             (+
              (* (/ 1.0 (/ (+ (/ (fma y x (/ (* (* x x) y) t)) t) y) t)) (* z y))
              x))
            (t_3 (tanh (/ x y)))
            (t_4 (- x (* (- t_3 (tanh (/ t y))) (* z y)))))
       (if (<= t_4 (- INFINITY))
         t_1
         (if (<= t_4 -1e+31)
           t_2
           (if (<= t_4 2e-21)
             (+
              (*
               (/ 1.0 (/ (+ (/ (fma t (* (/ y x) t) (* t y)) x) y) (- x)))
               (* z y))
              x)
             (if (<= t_4 2e+135)
               (fma (* (- (/ t y) t_3) z) y x)
               (if (<= t_4 1e+306) t_2 t_1)))))))
    double code(double x, double y, double z, double t) {
    	double t_1 = (t - x) * z;
    	double t_2 = ((1.0 / (((fma(y, x, (((x * x) * y) / t)) / t) + y) / t)) * (z * y)) + x;
    	double t_3 = tanh((x / y));
    	double t_4 = x - ((t_3 - tanh((t / y))) * (z * y));
    	double tmp;
    	if (t_4 <= -((double) INFINITY)) {
    		tmp = t_1;
    	} else if (t_4 <= -1e+31) {
    		tmp = t_2;
    	} else if (t_4 <= 2e-21) {
    		tmp = ((1.0 / (((fma(t, ((y / x) * t), (t * y)) / x) + y) / -x)) * (z * y)) + x;
    	} else if (t_4 <= 2e+135) {
    		tmp = fma((((t / y) - t_3) * z), y, x);
    	} else if (t_4 <= 1e+306) {
    		tmp = t_2;
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t)
    	t_1 = Float64(Float64(t - x) * z)
    	t_2 = Float64(Float64(Float64(1.0 / Float64(Float64(Float64(fma(y, x, Float64(Float64(Float64(x * x) * y) / t)) / t) + y) / t)) * Float64(z * y)) + x)
    	t_3 = tanh(Float64(x / y))
    	t_4 = Float64(x - Float64(Float64(t_3 - tanh(Float64(t / y))) * Float64(z * y)))
    	tmp = 0.0
    	if (t_4 <= Float64(-Inf))
    		tmp = t_1;
    	elseif (t_4 <= -1e+31)
    		tmp = t_2;
    	elseif (t_4 <= 2e-21)
    		tmp = Float64(Float64(Float64(1.0 / Float64(Float64(Float64(fma(t, Float64(Float64(y / x) * t), Float64(t * y)) / x) + y) / Float64(-x))) * Float64(z * y)) + x);
    	elseif (t_4 <= 2e+135)
    		tmp = fma(Float64(Float64(Float64(t / y) - t_3) * z), y, x);
    	elseif (t_4 <= 1e+306)
    		tmp = t_2;
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(1.0 / N[(N[(N[(N[(y * x + N[(N[(N[(x * x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$3 = N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(x - N[(N[(t$95$3 - N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], t$95$1, If[LessEqual[t$95$4, -1e+31], t$95$2, If[LessEqual[t$95$4, 2e-21], N[(N[(N[(1.0 / N[(N[(N[(N[(t * N[(N[(y / x), $MachinePrecision] * t), $MachinePrecision] + N[(t * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + y), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$4, 2e+135], N[(N[(N[(N[(t / y), $MachinePrecision] - t$95$3), $MachinePrecision] * z), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$4, 1e+306], t$95$2, t$95$1]]]]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \left(t - x\right) \cdot z\\
    t_2 := \frac{1}{\frac{\frac{\mathsf{fma}\left(y, x, \frac{\left(x \cdot x\right) \cdot y}{t}\right)}{t} + y}{t}} \cdot \left(z \cdot y\right) + x\\
    t_3 := \tanh \left(\frac{x}{y}\right)\\
    t_4 := x - \left(t\_3 - \tanh \left(\frac{t}{y}\right)\right) \cdot \left(z \cdot y\right)\\
    \mathbf{if}\;t\_4 \leq -\infty:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;t\_4 \leq -1 \cdot 10^{+31}:\\
    \;\;\;\;t\_2\\
    
    \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{-21}:\\
    \;\;\;\;\frac{1}{\frac{\frac{\mathsf{fma}\left(t, \frac{y}{x} \cdot t, t \cdot y\right)}{x} + y}{-x}} \cdot \left(z \cdot y\right) + x\\
    
    \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+135}:\\
    \;\;\;\;\mathsf{fma}\left(\left(\frac{t}{y} - t\_3\right) \cdot z, y, x\right)\\
    
    \mathbf{elif}\;t\_4 \leq 10^{+306}:\\
    \;\;\;\;t\_2\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -inf.0 or 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

      1. Initial program 51.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. *-commutativeN/A

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

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

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

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

        \[\leadsto z \cdot \color{blue}{\left(t - x\right)} \]
      7. Step-by-step derivation
        1. Applied rewrites100.0%

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

        if -inf.0 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -9.9999999999999996e30 or 1.99999999999999992e135 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.00000000000000002e306

        1. Initial program 99.9%

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

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

            \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
          2. lower--.f6438.3

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

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

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

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

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

              \[\leadsto x + \left(y \cdot z\right) \cdot \frac{1}{\frac{y + -1 \cdot \frac{-1 \cdot \left(x \cdot y\right) + -1 \cdot \frac{{x}^{2} \cdot y}{t}}{t}}{t}} \]
            3. Step-by-step derivation
              1. Applied rewrites78.0%

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

              if -9.9999999999999996e30 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.99999999999999982e-21

              1. Initial program 98.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}{\frac{t - x}{y}} \]
              4. Step-by-step derivation
                1. lower-/.f64N/A

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

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

                \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
              6. Step-by-step derivation
                1. Applied rewrites59.4%

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

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

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

                if 1.99999999999999982e-21 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.99999999999999992e135

                1. Initial program 99.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 \color{blue}{x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)} \]
                  2. +-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} \]
                  3. 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 \]
                  4. 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 \]
                  5. associate-*l*N/A

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

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

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

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

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

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

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

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

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

              Alternative 3: 78.4% accurate, 0.2× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t - x\right) \cdot z\\ t_2 := \frac{1}{\frac{\frac{\mathsf{fma}\left(y, x, \frac{\left(x \cdot x\right) \cdot y}{t}\right)}{t} + y}{t}} \cdot \left(z \cdot y\right) + x\\ t_3 := \tanh \left(\frac{t}{y}\right)\\ t_4 := x - \left(\tanh \left(\frac{x}{y}\right) - t\_3\right) \cdot \left(z \cdot y\right)\\ \mathbf{if}\;t\_4 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_4 \leq -2 \cdot 10^{+84}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+110}:\\ \;\;\;\;\mathsf{fma}\left(t\_3 \cdot y, z, \left(\left(-z\right) \cdot y\right) \cdot \frac{x}{y}\right) + x\\ \mathbf{elif}\;t\_4 \leq 10^{+306}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
              (FPCore (x y z t)
               :precision binary64
               (let* ((t_1 (* (- t x) z))
                      (t_2
                       (+
                        (* (/ 1.0 (/ (+ (/ (fma y x (/ (* (* x x) y) t)) t) y) t)) (* z y))
                        x))
                      (t_3 (tanh (/ t y)))
                      (t_4 (- x (* (- (tanh (/ x y)) t_3) (* z y)))))
                 (if (<= t_4 (- INFINITY))
                   t_1
                   (if (<= t_4 -2e+84)
                     t_2
                     (if (<= t_4 2e+110)
                       (+ (fma (* t_3 y) z (* (* (- z) y) (/ x y))) x)
                       (if (<= t_4 1e+306) t_2 t_1))))))
              double code(double x, double y, double z, double t) {
              	double t_1 = (t - x) * z;
              	double t_2 = ((1.0 / (((fma(y, x, (((x * x) * y) / t)) / t) + y) / t)) * (z * y)) + x;
              	double t_3 = tanh((t / y));
              	double t_4 = x - ((tanh((x / y)) - t_3) * (z * y));
              	double tmp;
              	if (t_4 <= -((double) INFINITY)) {
              		tmp = t_1;
              	} else if (t_4 <= -2e+84) {
              		tmp = t_2;
              	} else if (t_4 <= 2e+110) {
              		tmp = fma((t_3 * y), z, ((-z * y) * (x / y))) + x;
              	} else if (t_4 <= 1e+306) {
              		tmp = t_2;
              	} else {
              		tmp = t_1;
              	}
              	return tmp;
              }
              
              function code(x, y, z, t)
              	t_1 = Float64(Float64(t - x) * z)
              	t_2 = Float64(Float64(Float64(1.0 / Float64(Float64(Float64(fma(y, x, Float64(Float64(Float64(x * x) * y) / t)) / t) + y) / t)) * Float64(z * y)) + x)
              	t_3 = tanh(Float64(t / y))
              	t_4 = Float64(x - Float64(Float64(tanh(Float64(x / y)) - t_3) * Float64(z * y)))
              	tmp = 0.0
              	if (t_4 <= Float64(-Inf))
              		tmp = t_1;
              	elseif (t_4 <= -2e+84)
              		tmp = t_2;
              	elseif (t_4 <= 2e+110)
              		tmp = Float64(fma(Float64(t_3 * y), z, Float64(Float64(Float64(-z) * y) * Float64(x / y))) + x);
              	elseif (t_4 <= 1e+306)
              		tmp = t_2;
              	else
              		tmp = t_1;
              	end
              	return tmp
              end
              
              code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(1.0 / N[(N[(N[(N[(y * x + N[(N[(N[(x * x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$3 = N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(x - N[(N[(N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision] - t$95$3), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], t$95$1, If[LessEqual[t$95$4, -2e+84], t$95$2, If[LessEqual[t$95$4, 2e+110], N[(N[(N[(t$95$3 * y), $MachinePrecision] * z + N[(N[((-z) * y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$4, 1e+306], t$95$2, t$95$1]]]]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_1 := \left(t - x\right) \cdot z\\
              t_2 := \frac{1}{\frac{\frac{\mathsf{fma}\left(y, x, \frac{\left(x \cdot x\right) \cdot y}{t}\right)}{t} + y}{t}} \cdot \left(z \cdot y\right) + x\\
              t_3 := \tanh \left(\frac{t}{y}\right)\\
              t_4 := x - \left(\tanh \left(\frac{x}{y}\right) - t\_3\right) \cdot \left(z \cdot y\right)\\
              \mathbf{if}\;t\_4 \leq -\infty:\\
              \;\;\;\;t\_1\\
              
              \mathbf{elif}\;t\_4 \leq -2 \cdot 10^{+84}:\\
              \;\;\;\;t\_2\\
              
              \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+110}:\\
              \;\;\;\;\mathsf{fma}\left(t\_3 \cdot y, z, \left(\left(-z\right) \cdot y\right) \cdot \frac{x}{y}\right) + x\\
              
              \mathbf{elif}\;t\_4 \leq 10^{+306}:\\
              \;\;\;\;t\_2\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_1\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -inf.0 or 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

                1. Initial program 51.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. *-commutativeN/A

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

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

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

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

                  \[\leadsto z \cdot \color{blue}{\left(t - x\right)} \]
                7. Step-by-step derivation
                  1. Applied rewrites100.0%

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

                  if -inf.0 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -2.00000000000000012e84 or 2e110 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.00000000000000002e306

                  1. Initial program 99.9%

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

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

                      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
                    2. lower--.f6433.8

                      \[\leadsto x + \left(y \cdot z\right) \cdot \frac{\color{blue}{t - x}}{y} \]
                  5. Applied rewrites33.8%

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

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

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

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

                        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{1}{\frac{y + -1 \cdot \frac{-1 \cdot \left(x \cdot y\right) + -1 \cdot \frac{{x}^{2} \cdot y}{t}}{t}}{t}} \]
                      3. Step-by-step derivation
                        1. Applied rewrites77.6%

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

                        if -2.00000000000000012e84 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 2e110

                        1. Initial program 99.1%

                          \[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 \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\frac{x}{y}}\right) \]
                        4. Step-by-step derivation
                          1. lower-/.f6483.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      Alternative 4: 78.4% accurate, 0.2× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t - x\right) \cdot z\\ t_2 := \frac{1}{\frac{\frac{\mathsf{fma}\left(y, x, \frac{\left(x \cdot x\right) \cdot y}{t}\right)}{t} + y}{t}} \cdot \left(z \cdot y\right) + x\\ t_3 := \tanh \left(\frac{t}{y}\right)\\ t_4 := x - \left(\tanh \left(\frac{x}{y}\right) - t\_3\right) \cdot \left(z \cdot y\right)\\ \mathbf{if}\;t\_4 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_4 \leq -2 \cdot 10^{+84}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+110}:\\ \;\;\;\;\mathsf{fma}\left(t\_3 - \frac{x}{y}, z \cdot y, x\right)\\ \mathbf{elif}\;t\_4 \leq 10^{+306}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                      (FPCore (x y z t)
                       :precision binary64
                       (let* ((t_1 (* (- t x) z))
                              (t_2
                               (+
                                (* (/ 1.0 (/ (+ (/ (fma y x (/ (* (* x x) y) t)) t) y) t)) (* z y))
                                x))
                              (t_3 (tanh (/ t y)))
                              (t_4 (- x (* (- (tanh (/ x y)) t_3) (* z y)))))
                         (if (<= t_4 (- INFINITY))
                           t_1
                           (if (<= t_4 -2e+84)
                             t_2
                             (if (<= t_4 2e+110)
                               (fma (- t_3 (/ x y)) (* z y) x)
                               (if (<= t_4 1e+306) t_2 t_1))))))
                      double code(double x, double y, double z, double t) {
                      	double t_1 = (t - x) * z;
                      	double t_2 = ((1.0 / (((fma(y, x, (((x * x) * y) / t)) / t) + y) / t)) * (z * y)) + x;
                      	double t_3 = tanh((t / y));
                      	double t_4 = x - ((tanh((x / y)) - t_3) * (z * y));
                      	double tmp;
                      	if (t_4 <= -((double) INFINITY)) {
                      		tmp = t_1;
                      	} else if (t_4 <= -2e+84) {
                      		tmp = t_2;
                      	} else if (t_4 <= 2e+110) {
                      		tmp = fma((t_3 - (x / y)), (z * y), x);
                      	} else if (t_4 <= 1e+306) {
                      		tmp = t_2;
                      	} else {
                      		tmp = t_1;
                      	}
                      	return tmp;
                      }
                      
                      function code(x, y, z, t)
                      	t_1 = Float64(Float64(t - x) * z)
                      	t_2 = Float64(Float64(Float64(1.0 / Float64(Float64(Float64(fma(y, x, Float64(Float64(Float64(x * x) * y) / t)) / t) + y) / t)) * Float64(z * y)) + x)
                      	t_3 = tanh(Float64(t / y))
                      	t_4 = Float64(x - Float64(Float64(tanh(Float64(x / y)) - t_3) * Float64(z * y)))
                      	tmp = 0.0
                      	if (t_4 <= Float64(-Inf))
                      		tmp = t_1;
                      	elseif (t_4 <= -2e+84)
                      		tmp = t_2;
                      	elseif (t_4 <= 2e+110)
                      		tmp = fma(Float64(t_3 - Float64(x / y)), Float64(z * y), x);
                      	elseif (t_4 <= 1e+306)
                      		tmp = t_2;
                      	else
                      		tmp = t_1;
                      	end
                      	return tmp
                      end
                      
                      code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(1.0 / N[(N[(N[(N[(y * x + N[(N[(N[(x * x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$3 = N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(x - N[(N[(N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision] - t$95$3), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], t$95$1, If[LessEqual[t$95$4, -2e+84], t$95$2, If[LessEqual[t$95$4, 2e+110], N[(N[(t$95$3 - N[(x / y), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$4, 1e+306], t$95$2, t$95$1]]]]]]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      t_1 := \left(t - x\right) \cdot z\\
                      t_2 := \frac{1}{\frac{\frac{\mathsf{fma}\left(y, x, \frac{\left(x \cdot x\right) \cdot y}{t}\right)}{t} + y}{t}} \cdot \left(z \cdot y\right) + x\\
                      t_3 := \tanh \left(\frac{t}{y}\right)\\
                      t_4 := x - \left(\tanh \left(\frac{x}{y}\right) - t\_3\right) \cdot \left(z \cdot y\right)\\
                      \mathbf{if}\;t\_4 \leq -\infty:\\
                      \;\;\;\;t\_1\\
                      
                      \mathbf{elif}\;t\_4 \leq -2 \cdot 10^{+84}:\\
                      \;\;\;\;t\_2\\
                      
                      \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+110}:\\
                      \;\;\;\;\mathsf{fma}\left(t\_3 - \frac{x}{y}, z \cdot y, x\right)\\
                      
                      \mathbf{elif}\;t\_4 \leq 10^{+306}:\\
                      \;\;\;\;t\_2\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;t\_1\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -inf.0 or 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

                        1. Initial program 51.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. *-commutativeN/A

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

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

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

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

                          \[\leadsto z \cdot \color{blue}{\left(t - x\right)} \]
                        7. Step-by-step derivation
                          1. Applied rewrites100.0%

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

                          if -inf.0 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -2.00000000000000012e84 or 2e110 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.00000000000000002e306

                          1. Initial program 99.9%

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

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

                              \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
                            2. lower--.f6433.8

                              \[\leadsto x + \left(y \cdot z\right) \cdot \frac{\color{blue}{t - x}}{y} \]
                          5. Applied rewrites33.8%

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

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

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

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

                                \[\leadsto x + \left(y \cdot z\right) \cdot \frac{1}{\frac{y + -1 \cdot \frac{-1 \cdot \left(x \cdot y\right) + -1 \cdot \frac{{x}^{2} \cdot y}{t}}{t}}{t}} \]
                              3. Step-by-step derivation
                                1. Applied rewrites77.6%

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

                                if -2.00000000000000012e84 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 2e110

                                1. Initial program 99.1%

                                  \[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 \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\frac{x}{y}}\right) \]
                                4. Step-by-step derivation
                                  1. lower-/.f6483.7

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

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

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

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

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

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

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

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

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

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

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

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

                              Alternative 5: 70.1% accurate, 0.2× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t - x\right) \cdot z\\ t_2 := x - \left(\tanh \left(\frac{x}{y}\right) - \tanh \left(\frac{t}{y}\right)\right) \cdot \left(z \cdot y\right)\\ t_3 := \frac{1}{\frac{\frac{\mathsf{fma}\left(y, x, \frac{\left(x \cdot x\right) \cdot y}{t}\right)}{t} + y}{t}} \cdot \left(z \cdot y\right) + x\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+31}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-21}:\\ \;\;\;\;\frac{1}{\frac{\frac{\mathsf{fma}\left(t, \frac{y}{x} \cdot t, t \cdot y\right)}{x} + y}{-x}} \cdot \left(z \cdot y\right) + x\\ \mathbf{elif}\;t\_2 \leq 10^{+306}:\\ \;\;\;\;t\_3\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                              (FPCore (x y z t)
                               :precision binary64
                               (let* ((t_1 (* (- t x) z))
                                      (t_2 (- x (* (- (tanh (/ x y)) (tanh (/ t y))) (* z y))))
                                      (t_3
                                       (+
                                        (* (/ 1.0 (/ (+ (/ (fma y x (/ (* (* x x) y) t)) t) y) t)) (* z y))
                                        x)))
                                 (if (<= t_2 (- INFINITY))
                                   t_1
                                   (if (<= t_2 -1e+31)
                                     t_3
                                     (if (<= t_2 2e-21)
                                       (+
                                        (*
                                         (/ 1.0 (/ (+ (/ (fma t (* (/ y x) t) (* t y)) x) y) (- x)))
                                         (* z y))
                                        x)
                                       (if (<= t_2 1e+306) t_3 t_1))))))
                              double code(double x, double y, double z, double t) {
                              	double t_1 = (t - x) * z;
                              	double t_2 = x - ((tanh((x / y)) - tanh((t / y))) * (z * y));
                              	double t_3 = ((1.0 / (((fma(y, x, (((x * x) * y) / t)) / t) + y) / t)) * (z * y)) + x;
                              	double tmp;
                              	if (t_2 <= -((double) INFINITY)) {
                              		tmp = t_1;
                              	} else if (t_2 <= -1e+31) {
                              		tmp = t_3;
                              	} else if (t_2 <= 2e-21) {
                              		tmp = ((1.0 / (((fma(t, ((y / x) * t), (t * y)) / x) + y) / -x)) * (z * y)) + x;
                              	} else if (t_2 <= 1e+306) {
                              		tmp = t_3;
                              	} else {
                              		tmp = t_1;
                              	}
                              	return tmp;
                              }
                              
                              function code(x, y, z, t)
                              	t_1 = Float64(Float64(t - x) * z)
                              	t_2 = Float64(x - Float64(Float64(tanh(Float64(x / y)) - tanh(Float64(t / y))) * Float64(z * y)))
                              	t_3 = Float64(Float64(Float64(1.0 / Float64(Float64(Float64(fma(y, x, Float64(Float64(Float64(x * x) * y) / t)) / t) + y) / t)) * Float64(z * y)) + x)
                              	tmp = 0.0
                              	if (t_2 <= Float64(-Inf))
                              		tmp = t_1;
                              	elseif (t_2 <= -1e+31)
                              		tmp = t_3;
                              	elseif (t_2 <= 2e-21)
                              		tmp = Float64(Float64(Float64(1.0 / Float64(Float64(Float64(fma(t, Float64(Float64(y / x) * t), Float64(t * y)) / x) + y) / Float64(-x))) * Float64(z * y)) + x);
                              	elseif (t_2 <= 1e+306)
                              		tmp = t_3;
                              	else
                              		tmp = t_1;
                              	end
                              	return tmp
                              end
                              
                              code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(N[(N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(1.0 / N[(N[(N[(N[(y * x + N[(N[(N[(x * x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -1e+31], t$95$3, If[LessEqual[t$95$2, 2e-21], N[(N[(N[(1.0 / N[(N[(N[(N[(t * N[(N[(y / x), $MachinePrecision] * t), $MachinePrecision] + N[(t * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + y), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 1e+306], t$95$3, t$95$1]]]]]]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              t_1 := \left(t - x\right) \cdot z\\
                              t_2 := x - \left(\tanh \left(\frac{x}{y}\right) - \tanh \left(\frac{t}{y}\right)\right) \cdot \left(z \cdot y\right)\\
                              t_3 := \frac{1}{\frac{\frac{\mathsf{fma}\left(y, x, \frac{\left(x \cdot x\right) \cdot y}{t}\right)}{t} + y}{t}} \cdot \left(z \cdot y\right) + x\\
                              \mathbf{if}\;t\_2 \leq -\infty:\\
                              \;\;\;\;t\_1\\
                              
                              \mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+31}:\\
                              \;\;\;\;t\_3\\
                              
                              \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-21}:\\
                              \;\;\;\;\frac{1}{\frac{\frac{\mathsf{fma}\left(t, \frac{y}{x} \cdot t, t \cdot y\right)}{x} + y}{-x}} \cdot \left(z \cdot y\right) + x\\
                              
                              \mathbf{elif}\;t\_2 \leq 10^{+306}:\\
                              \;\;\;\;t\_3\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;t\_1\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 3 regimes
                              2. if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -inf.0 or 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y)))))

                                1. Initial program 51.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. *-commutativeN/A

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

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

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

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

                                  \[\leadsto z \cdot \color{blue}{\left(t - x\right)} \]
                                7. Step-by-step derivation
                                  1. Applied rewrites100.0%

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

                                  if -inf.0 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -9.9999999999999996e30 or 1.99999999999999982e-21 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.00000000000000002e306

                                  1. Initial program 99.9%

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

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

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

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

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

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

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

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

                                        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{1}{\frac{y + -1 \cdot \frac{-1 \cdot \left(x \cdot y\right) + -1 \cdot \frac{{x}^{2} \cdot y}{t}}{t}}{t}} \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites73.0%

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

                                        if -9.9999999999999996e30 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.99999999999999982e-21

                                        1. Initial program 98.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}{\frac{t - x}{y}} \]
                                        4. Step-by-step derivation
                                          1. lower-/.f64N/A

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

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

                                          \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
                                        6. Step-by-step derivation
                                          1. Applied rewrites59.4%

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

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

                                            \[\leadsto x + \left(y \cdot z\right) \cdot \frac{1}{\frac{y - \frac{-\mathsf{fma}\left(t, \frac{y}{x} \cdot t, t \cdot y\right)}{x}}{\color{blue}{-x}}} \]
                                        7. Recombined 3 regimes into one program.
                                        8. Final simplification76.9%

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

                                        Alternative 6: 62.8% accurate, 2.9× speedup?

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

                                          1. Initial program 96.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 x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
                                          4. Step-by-step derivation
                                            1. lower-/.f64N/A

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

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

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

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

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

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

                                                \[\leadsto x + \left(y \cdot z\right) \cdot \frac{1}{\frac{y + -1 \cdot \frac{-1 \cdot \left(x \cdot y\right) + -1 \cdot \frac{{x}^{2} \cdot y}{t}}{t}}{t}} \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites60.1%

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

                                                if 5e52 < y

                                                1. Initial program 81.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. *-commutativeN/A

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

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

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

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

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

                                              Alternative 7: 60.4% accurate, 3.7× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.32 \cdot 10^{-216}:\\ \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\ \mathbf{elif}\;y \leq 23:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(\frac{y}{t}, x, y\right)}{t}} \cdot \left(z \cdot y\right) + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\ \end{array} \end{array} \]
                                              (FPCore (x y z t)
                                               :precision binary64
                                               (if (<= y 1.32e-216)
                                                 (fma (- x) z x)
                                                 (if (<= y 23.0)
                                                   (+ (* (/ 1.0 (/ (fma (/ y t) x y) t)) (* z y)) x)
                                                   (fma (- t x) z x))))
                                              double code(double x, double y, double z, double t) {
                                              	double tmp;
                                              	if (y <= 1.32e-216) {
                                              		tmp = fma(-x, z, x);
                                              	} else if (y <= 23.0) {
                                              		tmp = ((1.0 / (fma((y / t), x, y) / t)) * (z * y)) + x;
                                              	} else {
                                              		tmp = fma((t - x), z, x);
                                              	}
                                              	return tmp;
                                              }
                                              
                                              function code(x, y, z, t)
                                              	tmp = 0.0
                                              	if (y <= 1.32e-216)
                                              		tmp = fma(Float64(-x), z, x);
                                              	elseif (y <= 23.0)
                                              		tmp = Float64(Float64(Float64(1.0 / Float64(fma(Float64(y / t), x, y) / t)) * Float64(z * y)) + x);
                                              	else
                                              		tmp = fma(Float64(t - x), z, x);
                                              	end
                                              	return tmp
                                              end
                                              
                                              code[x_, y_, z_, t_] := If[LessEqual[y, 1.32e-216], N[((-x) * z + x), $MachinePrecision], If[LessEqual[y, 23.0], N[(N[(N[(1.0 / N[(N[(N[(y / t), $MachinePrecision] * x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision]]]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \begin{array}{l}
                                              \mathbf{if}\;y \leq 1.32 \cdot 10^{-216}:\\
                                              \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
                                              
                                              \mathbf{elif}\;y \leq 23:\\
                                              \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(\frac{y}{t}, x, y\right)}{t}} \cdot \left(z \cdot y\right) + x\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 3 regimes
                                              2. if y < 1.31999999999999997e-216

                                                1. Initial program 95.1%

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

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

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

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

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

                                                  \[\leadsto \mathsf{fma}\left(-1 \cdot x, z, x\right) \]
                                                7. Step-by-step derivation
                                                  1. Applied rewrites52.9%

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

                                                  if 1.31999999999999997e-216 < y < 23

                                                  1. Initial program 99.9%

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

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

                                                      \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
                                                    2. lower--.f6435.4

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

                                                    \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
                                                  6. Step-by-step derivation
                                                    1. Applied rewrites35.4%

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

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

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

                                                      if 23 < y

                                                      1. Initial program 83.7%

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

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

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

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

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

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

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

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

                                                    Alternative 8: 59.9% accurate, 3.8× speedup?

                                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3.2 \cdot 10^{-105}:\\ \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\ \mathbf{elif}\;y \leq 3300000:\\ \;\;\;\;\left(\frac{\frac{y}{x} \cdot t}{y \cdot y} \cdot x\right) \cdot \left(z \cdot y\right) + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\ \end{array} \end{array} \]
                                                    (FPCore (x y z t)
                                                     :precision binary64
                                                     (if (<= y 3.2e-105)
                                                       (fma (- x) z x)
                                                       (if (<= y 3300000.0)
                                                         (+ (* (* (/ (* (/ y x) t) (* y y)) x) (* z y)) x)
                                                         (fma (- t x) z x))))
                                                    double code(double x, double y, double z, double t) {
                                                    	double tmp;
                                                    	if (y <= 3.2e-105) {
                                                    		tmp = fma(-x, z, x);
                                                    	} else if (y <= 3300000.0) {
                                                    		tmp = (((((y / x) * t) / (y * y)) * x) * (z * y)) + x;
                                                    	} else {
                                                    		tmp = fma((t - x), z, x);
                                                    	}
                                                    	return tmp;
                                                    }
                                                    
                                                    function code(x, y, z, t)
                                                    	tmp = 0.0
                                                    	if (y <= 3.2e-105)
                                                    		tmp = fma(Float64(-x), z, x);
                                                    	elseif (y <= 3300000.0)
                                                    		tmp = Float64(Float64(Float64(Float64(Float64(Float64(y / x) * t) / Float64(y * y)) * x) * Float64(z * y)) + x);
                                                    	else
                                                    		tmp = fma(Float64(t - x), z, x);
                                                    	end
                                                    	return tmp
                                                    end
                                                    
                                                    code[x_, y_, z_, t_] := If[LessEqual[y, 3.2e-105], N[((-x) * z + x), $MachinePrecision], If[LessEqual[y, 3300000.0], N[(N[(N[(N[(N[(N[(y / x), $MachinePrecision] * t), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision]]]
                                                    
                                                    \begin{array}{l}
                                                    
                                                    \\
                                                    \begin{array}{l}
                                                    \mathbf{if}\;y \leq 3.2 \cdot 10^{-105}:\\
                                                    \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
                                                    
                                                    \mathbf{elif}\;y \leq 3300000:\\
                                                    \;\;\;\;\left(\frac{\frac{y}{x} \cdot t}{y \cdot y} \cdot x\right) \cdot \left(z \cdot y\right) + x\\
                                                    
                                                    \mathbf{else}:\\
                                                    \;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
                                                    
                                                    
                                                    \end{array}
                                                    \end{array}
                                                    
                                                    Derivation
                                                    1. Split input into 3 regimes
                                                    2. if y < 3.19999999999999981e-105

                                                      1. Initial program 96.0%

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

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

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

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

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

                                                        \[\leadsto \mathsf{fma}\left(-1 \cdot x, z, x\right) \]
                                                      7. Step-by-step derivation
                                                        1. Applied rewrites51.9%

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

                                                        if 3.19999999999999981e-105 < y < 3.3e6

                                                        1. Initial program 99.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}{\frac{t - x}{y}} \]
                                                        4. Step-by-step derivation
                                                          1. lower-/.f64N/A

                                                            \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
                                                          2. lower--.f6441.7

                                                            \[\leadsto x + \left(y \cdot z\right) \cdot \frac{\color{blue}{t - x}}{y} \]
                                                        5. Applied rewrites41.7%

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

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

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

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

                                                            if 3.3e6 < y

                                                            1. Initial program 83.1%

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

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

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

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

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

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

                                                          Alternative 9: 60.0% accurate, 6.5× speedup?

                                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.75 \cdot 10^{-202}:\\ \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\ \mathbf{elif}\;y \leq 3300000:\\ \;\;\;\;\frac{t}{y} \cdot \left(z \cdot y\right) + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\ \end{array} \end{array} \]
                                                          (FPCore (x y z t)
                                                           :precision binary64
                                                           (if (<= y 1.75e-202)
                                                             (fma (- x) z x)
                                                             (if (<= y 3300000.0) (+ (* (/ t y) (* z y)) x) (fma (- t x) z x))))
                                                          double code(double x, double y, double z, double t) {
                                                          	double tmp;
                                                          	if (y <= 1.75e-202) {
                                                          		tmp = fma(-x, z, x);
                                                          	} else if (y <= 3300000.0) {
                                                          		tmp = ((t / y) * (z * y)) + x;
                                                          	} else {
                                                          		tmp = fma((t - x), z, x);
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          function code(x, y, z, t)
                                                          	tmp = 0.0
                                                          	if (y <= 1.75e-202)
                                                          		tmp = fma(Float64(-x), z, x);
                                                          	elseif (y <= 3300000.0)
                                                          		tmp = Float64(Float64(Float64(t / y) * Float64(z * y)) + x);
                                                          	else
                                                          		tmp = fma(Float64(t - x), z, x);
                                                          	end
                                                          	return tmp
                                                          end
                                                          
                                                          code[x_, y_, z_, t_] := If[LessEqual[y, 1.75e-202], N[((-x) * z + x), $MachinePrecision], If[LessEqual[y, 3300000.0], N[(N[(N[(t / y), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision]]]
                                                          
                                                          \begin{array}{l}
                                                          
                                                          \\
                                                          \begin{array}{l}
                                                          \mathbf{if}\;y \leq 1.75 \cdot 10^{-202}:\\
                                                          \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
                                                          
                                                          \mathbf{elif}\;y \leq 3300000:\\
                                                          \;\;\;\;\frac{t}{y} \cdot \left(z \cdot y\right) + x\\
                                                          
                                                          \mathbf{else}:\\
                                                          \;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
                                                          
                                                          
                                                          \end{array}
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Split input into 3 regimes
                                                          2. if y < 1.75e-202

                                                            1. Initial program 95.2%

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

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

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

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

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

                                                              \[\leadsto \mathsf{fma}\left(-1 \cdot x, z, x\right) \]
                                                            7. Step-by-step derivation
                                                              1. Applied rewrites52.5%

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

                                                              if 1.75e-202 < y < 3.3e6

                                                              1. Initial program 99.9%

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

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

                                                                  \[\leadsto x + \left(y \cdot z\right) \cdot \color{blue}{\frac{t - x}{y}} \]
                                                                2. lower--.f6436.2

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

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

                                                                \[\leadsto x + \left(y \cdot z\right) \cdot \frac{t}{\color{blue}{y}} \]
                                                              7. Step-by-step derivation
                                                                1. Applied rewrites55.5%

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

                                                                if 3.3e6 < y

                                                                1. Initial program 83.1%

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

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

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

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

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

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

                                                              Alternative 10: 63.3% accurate, 11.4× speedup?

                                                              \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t - x\right) \cdot z\\ \mathbf{if}\;z \leq -0.66:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2050000:\\ \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                                                              (FPCore (x y z t)
                                                               :precision binary64
                                                               (let* ((t_1 (* (- t x) z)))
                                                                 (if (<= z -0.66) t_1 (if (<= z 2050000.0) (fma (- x) z x) t_1))))
                                                              double code(double x, double y, double z, double t) {
                                                              	double t_1 = (t - x) * z;
                                                              	double tmp;
                                                              	if (z <= -0.66) {
                                                              		tmp = t_1;
                                                              	} else if (z <= 2050000.0) {
                                                              		tmp = fma(-x, z, x);
                                                              	} else {
                                                              		tmp = t_1;
                                                              	}
                                                              	return tmp;
                                                              }
                                                              
                                                              function code(x, y, z, t)
                                                              	t_1 = Float64(Float64(t - x) * z)
                                                              	tmp = 0.0
                                                              	if (z <= -0.66)
                                                              		tmp = t_1;
                                                              	elseif (z <= 2050000.0)
                                                              		tmp = fma(Float64(-x), z, x);
                                                              	else
                                                              		tmp = t_1;
                                                              	end
                                                              	return tmp
                                                              end
                                                              
                                                              code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -0.66], t$95$1, If[LessEqual[z, 2050000.0], N[((-x) * z + x), $MachinePrecision], t$95$1]]]
                                                              
                                                              \begin{array}{l}
                                                              
                                                              \\
                                                              \begin{array}{l}
                                                              t_1 := \left(t - x\right) \cdot z\\
                                                              \mathbf{if}\;z \leq -0.66:\\
                                                              \;\;\;\;t\_1\\
                                                              
                                                              \mathbf{elif}\;z \leq 2050000:\\
                                                              \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
                                                              
                                                              \mathbf{else}:\\
                                                              \;\;\;\;t\_1\\
                                                              
                                                              
                                                              \end{array}
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Split input into 2 regimes
                                                              2. if z < -0.660000000000000031 or 2.05e6 < z

                                                                1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

                                                                  if -0.660000000000000031 < z < 2.05e6

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

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

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

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

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

                                                                    \[\leadsto \mathsf{fma}\left(-1 \cdot x, z, x\right) \]
                                                                  7. Step-by-step derivation
                                                                    1. Applied rewrites80.9%

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

                                                                  Alternative 11: 20.8% accurate, 11.9× speedup?

                                                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.7 \cdot 10^{-160}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{-8}:\\ \;\;\;\;\left(-x\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \end{array} \]
                                                                  (FPCore (x y z t)
                                                                   :precision binary64
                                                                   (if (<= t -1.7e-160) (* t z) (if (<= t 1.6e-8) (* (- x) z) (* t z))))
                                                                  double code(double x, double y, double z, double t) {
                                                                  	double tmp;
                                                                  	if (t <= -1.7e-160) {
                                                                  		tmp = t * z;
                                                                  	} else if (t <= 1.6e-8) {
                                                                  		tmp = -x * z;
                                                                  	} else {
                                                                  		tmp = t * z;
                                                                  	}
                                                                  	return tmp;
                                                                  }
                                                                  
                                                                  real(8) function code(x, y, z, t)
                                                                      real(8), intent (in) :: x
                                                                      real(8), intent (in) :: y
                                                                      real(8), intent (in) :: z
                                                                      real(8), intent (in) :: t
                                                                      real(8) :: tmp
                                                                      if (t <= (-1.7d-160)) then
                                                                          tmp = t * z
                                                                      else if (t <= 1.6d-8) then
                                                                          tmp = -x * z
                                                                      else
                                                                          tmp = t * z
                                                                      end if
                                                                      code = tmp
                                                                  end function
                                                                  
                                                                  public static double code(double x, double y, double z, double t) {
                                                                  	double tmp;
                                                                  	if (t <= -1.7e-160) {
                                                                  		tmp = t * z;
                                                                  	} else if (t <= 1.6e-8) {
                                                                  		tmp = -x * z;
                                                                  	} else {
                                                                  		tmp = t * z;
                                                                  	}
                                                                  	return tmp;
                                                                  }
                                                                  
                                                                  def code(x, y, z, t):
                                                                  	tmp = 0
                                                                  	if t <= -1.7e-160:
                                                                  		tmp = t * z
                                                                  	elif t <= 1.6e-8:
                                                                  		tmp = -x * z
                                                                  	else:
                                                                  		tmp = t * z
                                                                  	return tmp
                                                                  
                                                                  function code(x, y, z, t)
                                                                  	tmp = 0.0
                                                                  	if (t <= -1.7e-160)
                                                                  		tmp = Float64(t * z);
                                                                  	elseif (t <= 1.6e-8)
                                                                  		tmp = Float64(Float64(-x) * z);
                                                                  	else
                                                                  		tmp = Float64(t * z);
                                                                  	end
                                                                  	return tmp
                                                                  end
                                                                  
                                                                  function tmp_2 = code(x, y, z, t)
                                                                  	tmp = 0.0;
                                                                  	if (t <= -1.7e-160)
                                                                  		tmp = t * z;
                                                                  	elseif (t <= 1.6e-8)
                                                                  		tmp = -x * z;
                                                                  	else
                                                                  		tmp = t * z;
                                                                  	end
                                                                  	tmp_2 = tmp;
                                                                  end
                                                                  
                                                                  code[x_, y_, z_, t_] := If[LessEqual[t, -1.7e-160], N[(t * z), $MachinePrecision], If[LessEqual[t, 1.6e-8], N[((-x) * z), $MachinePrecision], N[(t * z), $MachinePrecision]]]
                                                                  
                                                                  \begin{array}{l}
                                                                  
                                                                  \\
                                                                  \begin{array}{l}
                                                                  \mathbf{if}\;t \leq -1.7 \cdot 10^{-160}:\\
                                                                  \;\;\;\;t \cdot z\\
                                                                  
                                                                  \mathbf{elif}\;t \leq 1.6 \cdot 10^{-8}:\\
                                                                  \;\;\;\;\left(-x\right) \cdot z\\
                                                                  
                                                                  \mathbf{else}:\\
                                                                  \;\;\;\;t \cdot z\\
                                                                  
                                                                  
                                                                  \end{array}
                                                                  \end{array}
                                                                  
                                                                  Derivation
                                                                  1. Split input into 2 regimes
                                                                  2. if t < -1.70000000000000011e-160 or 1.6000000000000001e-8 < t

                                                                    1. Initial program 96.3%

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

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

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

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

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

                                                                      \[\leadsto t \cdot \color{blue}{z} \]
                                                                    7. Step-by-step derivation
                                                                      1. Applied rewrites24.5%

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

                                                                      if -1.70000000000000011e-160 < t < 1.6000000000000001e-8

                                                                      1. Initial program 88.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. *-commutativeN/A

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

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

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

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

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

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

                                                                          \[\leadsto \left(-1 \cdot x\right) \cdot z \]
                                                                        3. Step-by-step derivation
                                                                          1. Applied rewrites23.6%

                                                                            \[\leadsto \left(-x\right) \cdot z \]
                                                                        4. Recombined 2 regimes into one program.
                                                                        5. Add Preprocessing

                                                                        Alternative 12: 59.6% accurate, 14.9× speedup?

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

                                                                          1. Initial program 96.1%

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

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

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

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

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

                                                                            \[\leadsto \mathsf{fma}\left(-1 \cdot x, z, x\right) \]
                                                                          7. Step-by-step derivation
                                                                            1. Applied rewrites51.2%

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

                                                                            if 2.00000000000000004e-91 < y

                                                                            1. Initial program 87.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. *-commutativeN/A

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

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

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

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

                                                                          Alternative 13: 27.2% accurate, 26.6× speedup?

                                                                          \[\begin{array}{l} \\ \left(t - x\right) \cdot z \end{array} \]
                                                                          (FPCore (x y z t) :precision binary64 (* (- t x) z))
                                                                          double code(double x, double y, double z, double t) {
                                                                          	return (t - x) * z;
                                                                          }
                                                                          
                                                                          real(8) function code(x, y, z, t)
                                                                              real(8), intent (in) :: x
                                                                              real(8), intent (in) :: y
                                                                              real(8), intent (in) :: z
                                                                              real(8), intent (in) :: t
                                                                              code = (t - x) * z
                                                                          end function
                                                                          
                                                                          public static double code(double x, double y, double z, double t) {
                                                                          	return (t - x) * z;
                                                                          }
                                                                          
                                                                          def code(x, y, z, t):
                                                                          	return (t - x) * z
                                                                          
                                                                          function code(x, y, z, t)
                                                                          	return Float64(Float64(t - x) * z)
                                                                          end
                                                                          
                                                                          function tmp = code(x, y, z, t)
                                                                          	tmp = (t - x) * z;
                                                                          end
                                                                          
                                                                          code[x_, y_, z_, t_] := N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]
                                                                          
                                                                          \begin{array}{l}
                                                                          
                                                                          \\
                                                                          \left(t - x\right) \cdot z
                                                                          \end{array}
                                                                          
                                                                          Derivation
                                                                          1. Initial program 93.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. *-commutativeN/A

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

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

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

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

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

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

                                                                            Alternative 14: 17.1% accurate, 39.8× speedup?

                                                                            \[\begin{array}{l} \\ t \cdot z \end{array} \]
                                                                            (FPCore (x y z t) :precision binary64 (* t z))
                                                                            double code(double x, double y, double z, double t) {
                                                                            	return t * z;
                                                                            }
                                                                            
                                                                            real(8) function code(x, y, z, t)
                                                                                real(8), intent (in) :: x
                                                                                real(8), intent (in) :: y
                                                                                real(8), intent (in) :: z
                                                                                real(8), intent (in) :: t
                                                                                code = t * z
                                                                            end function
                                                                            
                                                                            public static double code(double x, double y, double z, double t) {
                                                                            	return t * z;
                                                                            }
                                                                            
                                                                            def code(x, y, z, t):
                                                                            	return t * z
                                                                            
                                                                            function code(x, y, z, t)
                                                                            	return Float64(t * z)
                                                                            end
                                                                            
                                                                            function tmp = code(x, y, z, t)
                                                                            	tmp = t * z;
                                                                            end
                                                                            
                                                                            code[x_, y_, z_, t_] := N[(t * z), $MachinePrecision]
                                                                            
                                                                            \begin{array}{l}
                                                                            
                                                                            \\
                                                                            t \cdot z
                                                                            \end{array}
                                                                            
                                                                            Derivation
                                                                            1. Initial program 93.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. *-commutativeN/A

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

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

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

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

                                                                              \[\leadsto t \cdot \color{blue}{z} \]
                                                                            7. Step-by-step derivation
                                                                              1. Applied rewrites18.8%

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

                                                                              Developer Target 1: 97.1% accurate, 1.0× speedup?

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

                                                                              Reproduce

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