SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.5% → 98.1%
Time: 12.3s
Alternatives: 12
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 12 alternatives:

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

Initial Program: 93.5% accurate, 1.0× speedup?

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

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

Alternative 1: 98.1% 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 94.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y, z, x\right)} \]
    14. lower-*.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 2: 80.2% accurate, 1.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.4e-9 or 1.2999999999999999e25 < x

    1. Initial program 97.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y}, z, x\right) \]
    4. Applied 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-/.f6478.6

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

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

    if -7.4e-9 < x < 1.2999999999999999e25

    1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 80.2% accurate, 1.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.4e-9 or 1.2999999999999999e25 < x

    1. Initial program 97.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot y}, z, x\right) \]
    4. Applied 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-/.f6478.6

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

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

    if -7.4e-9 < x < 1.2999999999999999e25

    1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 64.1% accurate, 1.6× speedup?

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

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

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

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


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

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 y around inf

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{neg}\left(\color{blue}{-1 \cdot \left(t - x\right)}\right)}{y} \cdot y, z, x\right) \]
      3. distribute-lft-out--N/A

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{neg}\left(\left(-1 \cdot t - -1 \cdot x\right)\right)}}{y} \cdot y, z, x\right) \]
      7. distribute-lft-out--N/A

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{t - x}}{y} \cdot y, z, x\right) \]
      2. associate-*l/N/A

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

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

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

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

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

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

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

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

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

    if 8.1999999999999995e-218 < y < 4.8000000000000001e172

    1. Initial program 98.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 x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.8000000000000001e172 < y

    1. Initial program 71.2%

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

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

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

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

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

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

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

Alternative 5: 64.1% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 y around inf

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{neg}\left(\color{blue}{-1 \cdot \left(t - x\right)}\right)}{y} \cdot y, z, x\right) \]
      3. distribute-lft-out--N/A

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{neg}\left(\left(-1 \cdot t - -1 \cdot x\right)\right)}}{y} \cdot y, z, x\right) \]
      7. distribute-lft-out--N/A

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{t - x}}{y} \cdot y, z, x\right) \]
      2. associate-*l/N/A

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

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

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

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

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

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

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

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

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

    if 8.1999999999999995e-218 < y

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 57.0% accurate, 7.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.15 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(-\frac{y \cdot x}{y}, z, 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 < 2.15e15

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 y around inf

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{neg}\left(\color{blue}{-1 \cdot \left(t - x\right)}\right)}{y} \cdot y, z, x\right) \]
      3. distribute-lft-out--N/A

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{neg}\left(\left(-1 \cdot t - -1 \cdot x\right)\right)}}{y} \cdot y, z, x\right) \]
      7. distribute-lft-out--N/A

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{t - x}}{y} \cdot y, z, x\right) \]
      2. associate-*l/N/A

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

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

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

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

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

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

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

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

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

    if 2.15e15 < y

    1. Initial program 87.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--.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)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.4%

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

Alternative 7: 59.9% accurate, 8.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{-218}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t \cdot y}{y}, z, x\right)\\ \mathbf{elif}\;y \leq 2.15 \cdot 10^{+15}:\\ \;\;\;\;\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 8e-218)
   (fma (/ (* t y) y) z x)
   (if (<= y 2.15e+15) (fma z (- x) x) (fma z (- t x) x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 8e-218) {
		tmp = fma(((t * y) / y), z, x);
	} else if (y <= 2.15e+15) {
		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 <= 8e-218)
		tmp = fma(Float64(Float64(t * y) / y), z, x);
	elseif (y <= 2.15e+15)
		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, 8e-218], N[(N[(N[(t * y), $MachinePrecision] / y), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[y, 2.15e+15], N[(z * (-x) + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 2.15 \cdot 10^{+15}:\\
\;\;\;\;\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 3 regimes
  2. if y < 8.0000000000000003e-218

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 y around inf

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{neg}\left(\color{blue}{-1 \cdot \left(t - x\right)}\right)}{y} \cdot y, z, x\right) \]
      3. distribute-lft-out--N/A

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{neg}\left(\left(-1 \cdot t - -1 \cdot x\right)\right)}}{y} \cdot y, z, x\right) \]
      7. distribute-lft-out--N/A

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{t - x}}{y} \cdot y, z, x\right) \]
      2. associate-*l/N/A

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

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

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

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

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

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

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

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

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

    if 8.0000000000000003e-218 < y < 2.15e15

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if 2.15e15 < y

    1. Initial program 87.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--.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)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification63.1%

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

Alternative 8: 62.4% accurate, 11.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(t - x\right)\\ \mathbf{if}\;z \leq -4.6 \cdot 10^{-28}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{+18}:\\ \;\;\;\;\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 -4.6e-28) t_1 (if (<= z 3.5e+18) (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 <= -4.6e-28) {
		tmp = t_1;
	} else if (z <= 3.5e+18) {
		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 <= -4.6e-28)
		tmp = t_1;
	elseif (z <= 3.5e+18)
		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, -4.6e-28], t$95$1, If[LessEqual[z, 3.5e+18], 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 -4.6 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 3.5 \cdot 10^{+18}:\\
\;\;\;\;\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 < -4.59999999999999971e-28 or 3.5e18 < z

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

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

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

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

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

        \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(t - x\right)}\right)\right) \]
      3. distribute-lft-out--N/A

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

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

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

        \[\leadsto z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot t - -1 \cdot x\right)\right)\right)} \]
      7. distribute-lft-out--N/A

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

        \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(t - x\right)\right)\right)}\right)\right) \]
      9. remove-double-negN/A

        \[\leadsto z \cdot \color{blue}{\left(t - x\right)} \]
      10. lower--.f6440.8

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

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

    if -4.59999999999999971e-28 < z < 3.5e18

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 21.4% accurate, 11.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -4.6 \cdot 10^{-189}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;t \leq 3.8 \cdot 10^{-108}:\\ \;\;\;\;-x \cdot z\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -4.6e-189) (* t z) (if (<= t 3.8e-108) (- (* x z)) (* t z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -4.6e-189) {
		tmp = t * z;
	} else if (t <= 3.8e-108) {
		tmp = -(x * z);
	} else {
		tmp = t * z;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-4.6d-189)) then
        tmp = t * z
    else if (t <= 3.8d-108) then
        tmp = -(x * z)
    else
        tmp = t * z
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -4.6e-189) {
		tmp = t * z;
	} else if (t <= 3.8e-108) {
		tmp = -(x * z);
	} else {
		tmp = t * z;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -4.6e-189:
		tmp = t * z
	elif t <= 3.8e-108:
		tmp = -(x * z)
	else:
		tmp = t * z
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -4.6e-189)
		tmp = Float64(t * z);
	elseif (t <= 3.8e-108)
		tmp = Float64(-Float64(x * z));
	else
		tmp = Float64(t * z);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -4.6e-189)
		tmp = t * z;
	elseif (t <= 3.8e-108)
		tmp = -(x * z);
	else
		tmp = t * z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.6e-189], N[(t * z), $MachinePrecision], If[LessEqual[t, 3.8e-108], (-N[(x * z), $MachinePrecision]), N[(t * z), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{-189}:\\
\;\;\;\;t \cdot z\\

\mathbf{elif}\;t \leq 3.8 \cdot 10^{-108}:\\
\;\;\;\;-x \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.5999999999999996e-189 or 3.79999999999999973e-108 < t

    1. Initial program 94.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--.f6456.0

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

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

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

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

        \[\leadsto \color{blue}{z \cdot t} \]
    8. Applied rewrites19.8%

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

    if -4.5999999999999996e-189 < t < 3.79999999999999973e-108

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 y around inf

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{neg}\left(\color{blue}{-1 \cdot \left(t - x\right)}\right)}{y} \cdot y, z, x\right) \]
      3. distribute-lft-out--N/A

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{neg}\left(\left(-1 \cdot t - -1 \cdot x\right)\right)}}{y} \cdot y, z, x\right) \]
      7. distribute-lft-out--N/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(t - x\right) \cdot z} \]
      2. remove-double-negN/A

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

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(t - x\right)}\right)\right) \cdot z \]
      4. distribute-lft-out--N/A

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

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

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

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot t - -1 \cdot x\right)\right)\right)} \cdot z \]
      8. distribute-lft-out--N/A

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

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(t - x\right)\right)\right)}\right)\right) \cdot z \]
      10. remove-double-negN/A

        \[\leadsto \color{blue}{\left(t - x\right)} \cdot z \]
      11. lower--.f6428.1

        \[\leadsto \color{blue}{\left(t - x\right)} \cdot z \]
    10. Applied rewrites28.1%

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

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot z\right)} \]
    12. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

        \[\leadsto \color{blue}{\left(-x\right)} \cdot z \]
    13. Applied rewrites28.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.6 \cdot 10^{-189}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;t \leq 3.8 \cdot 10^{-108}:\\ \;\;\;\;-x \cdot z\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 59.2% accurate, 14.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 2.15 \cdot 10^{+15}:\\ \;\;\;\;\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 2.15e+15) (fma z (- x) x) (fma z (- t x) x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.15e+15) {
		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 <= 2.15e+15)
		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, 2.15e+15], N[(z * (-x) + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.15 \cdot 10^{+15}:\\
\;\;\;\;\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 < 2.15e15

    1. Initial program 95.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--.f6457.2

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

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

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

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

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

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

    if 2.15e15 < y

    1. Initial program 87.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--.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)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 26.9% accurate, 26.6× speedup?

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

\\
z \cdot \left(t - x\right)
\end{array}
Derivation
  1. Initial program 94.2%

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

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

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

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

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

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

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

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

      \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(t - x\right)}\right)\right) \]
    3. distribute-lft-out--N/A

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

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

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

      \[\leadsto z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot t - -1 \cdot x\right)\right)\right)} \]
    7. distribute-lft-out--N/A

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

      \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(t - x\right)\right)\right)}\right)\right) \]
    9. remove-double-negN/A

      \[\leadsto z \cdot \color{blue}{\left(t - x\right)} \]
    10. lower--.f6424.5

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

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

Alternative 12: 17.5% accurate, 39.8× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot t} \]
  8. Applied rewrites15.6%

    \[\leadsto \color{blue}{z \cdot t} \]
  9. Final simplification15.6%

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