SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.3% → 97.6%
Time: 12.6s
Alternatives: 9
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 9 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: 97.6% accurate, 1.0× speedup?

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

\\
\mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, \tanh \left(\frac{x}{y}\right) \cdot \left(-y\right)\right), z, x\right)
\end{array}
Derivation
  1. Initial program 92.8%

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

      \[\leadsto \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-*.f6497.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 rewrites97.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. Step-by-step derivation
    1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.6% 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 92.8%

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

      \[\leadsto \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-*.f6497.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 rewrites97.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. Final simplification97.7%

    \[\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 3: 79.5% accurate, 1.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.49999999999999988e-48 or 3.50000000000000005e-65 < t

    1. Initial program 94.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-*.f6499.9

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

      \[\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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.49999999999999988e-48 < t < 3.50000000000000005e-65

    1. Initial program 90.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 t around 0

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

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

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

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

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

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

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

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

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

Alternative 4: 76.1% accurate, 1.9× speedup?

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

\\
\mathsf{fma}\left(\mathsf{fma}\left(\tanh \left(\frac{t}{y}\right), y, -x\right), z, x\right)
\end{array}
Derivation
  1. Initial program 92.8%

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

      \[\leadsto \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-*.f6497.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 rewrites97.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. Step-by-step derivation
    1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 62.7% accurate, 11.4× speedup?

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

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

\mathbf{elif}\;z \leq 1.64 \cdot 10^{-15}:\\
\;\;\;\;x - x \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.4999999999999999e-6 or 1.64000000000000002e-15 < z

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

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

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

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

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

      if -5.4999999999999999e-6 < z < 1.64000000000000002e-15

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

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

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

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

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

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

          \[\leadsto x - \color{blue}{x \cdot z} \]
      8. Recombined 2 regimes into one program.
      9. Add Preprocessing

      Alternative 6: 20.7% accurate, 11.9× speedup?

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

        1. Initial program 94.7%

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

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

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

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

            \[\leadsto \mathsf{fma}\left(z, \color{blue}{t - x}, x\right) \]
        5. Applied rewrites51.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 rewrites25.7%

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

          if -7.2000000000000002e-24 < t < 2.70000000000000014e-171

          1. Initial program 89.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--.f6477.1

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

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

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

                \[\leadsto z \cdot \left(-x\right) \]
            4. Recombined 2 regimes into one program.
            5. Final simplification25.7%

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

            Alternative 7: 59.2% accurate, 14.9× speedup?

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

              1. Initial program 95.4%

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

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

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

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

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

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

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

                  \[\leadsto x - \color{blue}{x \cdot z} \]

                if 2.24999999999999989e-17 < y

                1. Initial program 85.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--.f6484.1

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

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

              Alternative 8: 27.2% 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 92.8%

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

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

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

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

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

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

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

                Alternative 9: 17.4% 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 92.8%

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

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

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

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

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

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

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

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

                  Developer Target 1: 96.8% 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 2024228 
                  (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))))))