SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.6% → 97.9%
Time: 13.1s
Alternatives: 11
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 93.6% accurate, 1.0× speedup?

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

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

Alternative 1: 97.9% accurate, 1.0× speedup?

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

\\
\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), z, x\right)
\end{array}
Derivation
  1. Initial program 95.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. *-commutativeN/A

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

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

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

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

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

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

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

Alternative 2: 77.7% accurate, 1.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.2000000000000001e124

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if -2.2000000000000001e124 < x < 1.3500000000000001e59

    1. Initial program 93.7%

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

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

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

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

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

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

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

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

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

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

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

    if 1.3500000000000001e59 < x

    1. Initial program 98.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. lower-fma.f64N/A

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
    6. Step-by-step derivation
      1. Applied rewrites41.6%

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

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

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

          \[\leadsto \mathsf{fma}\left(z, \frac{1}{\frac{-1 \cdot \frac{\frac{{t}^{2}}{x} - -1 \cdot t}{x} - 1}{x}}, x\right) \]
        3. Step-by-step derivation
          1. Applied rewrites82.3%

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

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

        Alternative 3: 65.9% accurate, 1.7× speedup?

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

          1. Initial program 97.8%

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
          6. Step-by-step derivation
            1. Applied rewrites41.6%

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

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

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

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

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

                if 7e-109 < y

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

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

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

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

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

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

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

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

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

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

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

              Alternative 4: 65.2% accurate, 3.5× speedup?

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

                1. Initial program 98.0%

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

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

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

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

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

                  \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
                6. Step-by-step derivation
                  1. Applied rewrites40.6%

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

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

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

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

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

                      if 9e7 < y

                      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. lower-fma.f64N/A

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

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

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

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

                    Alternative 5: 62.6% accurate, 4.9× speedup?

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

                      1. Initial program 98.0%

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

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

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, x\right)} \]
                      6. Step-by-step derivation
                        1. Applied rewrites40.6%

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

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

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

                          if 9e7 < y

                          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. lower-fma.f64N/A

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

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

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

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

                        Alternative 6: 59.8% accurate, 8.8× speedup?

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

                          1. Initial program 97.9%

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

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

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

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

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

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

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

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

                              \[\leadsto \left(\mathsf{neg}\left(t\right)\right) \cdot \left(-1 \cdot \frac{x}{\color{blue}{t}}\right) \]
                            3. Step-by-step derivation
                              1. Applied rewrites49.6%

                                \[\leadsto \left(-t\right) \cdot \frac{x}{-t} \]

                              if 1.70000000000000001e-103 < y

                              1. Initial program 89.7%

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

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

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

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

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

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

                            Alternative 7: 62.5% accurate, 11.4× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(t - x\right)\\ \mathbf{if}\;z \leq -1050000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{+39}:\\ \;\;\;\;\mathsf{fma}\left(z, -x, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                            (FPCore (x y z t)
                             :precision binary64
                             (let* ((t_1 (* z (- t x))))
                               (if (<= z -1050000000.0) t_1 (if (<= z 1.25e+39) (fma z (- x) x) t_1))))
                            double code(double x, double y, double z, double t) {
                            	double t_1 = z * (t - x);
                            	double tmp;
                            	if (z <= -1050000000.0) {
                            		tmp = t_1;
                            	} else if (z <= 1.25e+39) {
                            		tmp = fma(z, -x, x);
                            	} else {
                            		tmp = t_1;
                            	}
                            	return tmp;
                            }
                            
                            function code(x, y, z, t)
                            	t_1 = Float64(z * Float64(t - x))
                            	tmp = 0.0
                            	if (z <= -1050000000.0)
                            		tmp = t_1;
                            	elseif (z <= 1.25e+39)
                            		tmp = fma(z, Float64(-x), x);
                            	else
                            		tmp = t_1;
                            	end
                            	return tmp
                            end
                            
                            code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1050000000.0], t$95$1, If[LessEqual[z, 1.25e+39], N[(z * (-x) + x), $MachinePrecision], t$95$1]]]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            t_1 := z \cdot \left(t - x\right)\\
                            \mathbf{if}\;z \leq -1050000000:\\
                            \;\;\;\;t\_1\\
                            
                            \mathbf{elif}\;z \leq 1.25 \cdot 10^{+39}:\\
                            \;\;\;\;\mathsf{fma}\left(z, -x, x\right)\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;t\_1\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if z < -1.05e9 or 1.25000000000000004e39 < z

                              1. Initial program 91.3%

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

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

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

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

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

                                \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, 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 rewrites46.3%

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

                                if -1.05e9 < z < 1.25000000000000004e39

                                1. Initial program 99.3%

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

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

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

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

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

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

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

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

                                Alternative 8: 20.4% accurate, 11.9× speedup?

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

                                  1. Initial program 96.4%

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto z \cdot \left(-x\right) \]

                                        if -1.32000000000000006e-105 < x < 1.35e-76

                                        1. Initial program 94.0%

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

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

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

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

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

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

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

                                            \[\leadsto z \cdot \color{blue}{t} \]
                                        8. Recombined 2 regimes into one program.
                                        9. Final simplification23.9%

                                          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.32 \cdot 10^{-105}:\\ \;\;\;\;z \cdot \left(-x\right)\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-76}:\\ \;\;\;\;t \cdot z\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-x\right)\\ \end{array} \]
                                        10. Add Preprocessing

                                        Alternative 9: 60.1% accurate, 14.9× speedup?

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

                                          1. Initial program 98.0%

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

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

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

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

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

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

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

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

                                            if 6.6e7 < y

                                            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. lower-fma.f64N/A

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

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

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

                                          Alternative 10: 26.4% accurate, 26.6× speedup?

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

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

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

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

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

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

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(z, t - x, 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 rewrites26.6%

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

                                            Alternative 11: 16.6% accurate, 39.8× speedup?

                                            \[\begin{array}{l} \\ t \cdot z \end{array} \]
                                            (FPCore (x y z t) :precision binary64 (* t z))
                                            double code(double x, double y, double z, double t) {
                                            	return t * z;
                                            }
                                            
                                            real(8) function code(x, y, z, t)
                                                real(8), intent (in) :: x
                                                real(8), intent (in) :: y
                                                real(8), intent (in) :: z
                                                real(8), intent (in) :: t
                                                code = t * z
                                            end function
                                            
                                            public static double code(double x, double y, double z, double t) {
                                            	return t * z;
                                            }
                                            
                                            def code(x, y, z, t):
                                            	return t * z
                                            
                                            function code(x, y, z, t)
                                            	return Float64(t * z)
                                            end
                                            
                                            function tmp = code(x, y, z, t)
                                            	tmp = t * z;
                                            end
                                            
                                            code[x_, y_, z_, t_] := N[(t * z), $MachinePrecision]
                                            
                                            \begin{array}{l}
                                            
                                            \\
                                            t \cdot z
                                            \end{array}
                                            
                                            Derivation
                                            1. Initial program 95.5%

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

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

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

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

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

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

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

                                                \[\leadsto z \cdot \color{blue}{t} \]
                                              2. Final simplification16.9%

                                                \[\leadsto t \cdot z \]
                                              3. 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 2024233 
                                              (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))))))