SynthBasics:moogVCF from YampaSynth-0.2

Percentage Accurate: 93.5% → 97.0%
Time: 9.2s
Alternatives: 11
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
double code(double x, double y, double z, double t) {
	return x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 93.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
double code(double x, double y, double z, double t) {
	return x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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

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

Alternative 1: 97.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{\frac{\frac{e^{\frac{x}{y}} - e^{\mathsf{neg}\left(\frac{x}{y}\right)}}{2}}{\cosh \left(\frac{x}{y}\right)}}\right), y, x\right) \]
    9. sinh-defN/A

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \color{blue}{1 \cdot \frac{\sinh \left(\frac{x}{y}\right)}{\cosh \left(\frac{x}{y}\right)}}\right), y, x\right) \]
    14. flip3--N/A

      \[\leadsto \mathsf{fma}\left(z \cdot \color{blue}{\frac{{\tanh \left(\frac{t}{y}\right)}^{3} - {\left(1 \cdot \frac{\sinh \left(\frac{x}{y}\right)}{\cosh \left(\frac{x}{y}\right)}\right)}^{3}}{\tanh \left(\frac{t}{y}\right) \cdot \tanh \left(\frac{t}{y}\right) + \left(\left(1 \cdot \frac{\sinh \left(\frac{x}{y}\right)}{\cosh \left(\frac{x}{y}\right)}\right) \cdot \left(1 \cdot \frac{\sinh \left(\frac{x}{y}\right)}{\cosh \left(\frac{x}{y}\right)}\right) + \tanh \left(\frac{t}{y}\right) \cdot \left(1 \cdot \frac{\sinh \left(\frac{x}{y}\right)}{\cosh \left(\frac{x}{y}\right)}\right)\right)}}, y, x\right) \]
  6. Applied rewrites96.4%

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

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

Alternative 2: 97.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 84.2% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 93.8%

      \[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. 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) \]
      2. tanh-def-cN/A

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

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

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{\color{blue}{1 - e^{-2 \cdot \frac{x}{y}}}}{1 + e^{-2 \cdot \frac{x}{y}}}\right) \]
      5. exp-prodN/A

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

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

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

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

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{1 - {\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}}{\color{blue}{e^{-2 \cdot \frac{x}{y}} + 1}}\right) \]
      10. exp-prodN/A

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

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{1 - {\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}}{\color{blue}{{\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}} + 1}\right) \]
      12. lower-exp.f6463.8

        \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{1 - {\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}}{{\color{blue}{\left(e^{-2}\right)}}^{\left(\frac{x}{y}\right)} + 1}\right) \]
    4. Applied rewrites63.8%

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

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

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

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

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

        \[\leadsto x + \left(y \cdot z\right) \cdot \frac{\frac{\left(x \cdot x\right) \cdot 0}{y}}{y} \]
      2. Applied rewrites91.5%

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

      if -7e98 < x < 2.3999999999999999e77

      1. Initial program 87.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-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) \]
        2. tanh-def-cN/A

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

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

          \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{\color{blue}{1 - e^{-2 \cdot \frac{x}{y}}}}{1 + e^{-2 \cdot \frac{x}{y}}}\right) \]
        5. exp-prodN/A

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

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

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

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

          \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{1 - {\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}}{\color{blue}{e^{-2 \cdot \frac{x}{y}} + 1}}\right) \]
        10. exp-prodN/A

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

          \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{1 - {\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}}{\color{blue}{{\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}} + 1}\right) \]
        12. lower-exp.f6467.1

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

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

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

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

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

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

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

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

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

          \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{2 \cdot \color{blue}{\frac{x}{y}}}{\mathsf{fma}\left(-2, \frac{x}{y}, 1\right) + 1}\right) \]
      10. Applied rewrites78.0%

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

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

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

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

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

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

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

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

      if 2.3999999999999999e77 < x

      1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 4: 81.2% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6.8 \cdot 10^{+53} \lor \neg \left(y \leq 1.32 \cdot 10^{-62}\right):\\ \;\;\;\;\mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) \cdot y, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{0}{y} \cdot z, y, x\right)\\ \end{array} \end{array} \]
    (FPCore (x y z t)
     :precision binary64
     (if (or (<= y -6.8e+53) (not (<= y 1.32e-62)))
       (fma (* (- (tanh (/ t y)) (/ x y)) y) z x)
       (fma (* (/ 0.0 y) z) y x)))
    double code(double x, double y, double z, double t) {
    	double tmp;
    	if ((y <= -6.8e+53) || !(y <= 1.32e-62)) {
    		tmp = fma(((tanh((t / y)) - (x / y)) * y), z, x);
    	} else {
    		tmp = fma(((0.0 / y) * z), y, x);
    	}
    	return tmp;
    }
    
    function code(x, y, z, t)
    	tmp = 0.0
    	if ((y <= -6.8e+53) || !(y <= 1.32e-62))
    		tmp = fma(Float64(Float64(tanh(Float64(t / y)) - Float64(x / y)) * y), z, x);
    	else
    		tmp = fma(Float64(Float64(0.0 / y) * z), y, x);
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.8e+53], N[Not[LessEqual[y, 1.32e-62]], $MachinePrecision]], N[(N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(N[(0.0 / y), $MachinePrecision] * z), $MachinePrecision] * y + x), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -6.8 \cdot 10^{+53} \lor \neg \left(y \leq 1.32 \cdot 10^{-62}\right):\\
    \;\;\;\;\mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) \cdot y, z, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\frac{0}{y} \cdot z, y, x\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -6.79999999999999995e53 or 1.31999999999999997e-62 < y

      1. Initial program 81.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 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-/.f6473.7

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

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

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

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

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

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

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

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

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

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

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

      if -6.79999999999999995e53 < y < 1.31999999999999997e-62

      1. Initial program 99.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-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) \]
        2. tanh-def-cN/A

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

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

          \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{\color{blue}{1 - e^{-2 \cdot \frac{x}{y}}}}{1 + e^{-2 \cdot \frac{x}{y}}}\right) \]
        5. exp-prodN/A

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

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

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

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

          \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{1 - {\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}}{\color{blue}{e^{-2 \cdot \frac{x}{y}} + 1}}\right) \]
        10. exp-prodN/A

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

          \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{1 - {\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}}{\color{blue}{{\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}} + 1}\right) \]
        12. lower-exp.f6465.4

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

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

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

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

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

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

          \[\leadsto x + \left(y \cdot z\right) \cdot \frac{\frac{\left(x \cdot x\right) \cdot 0}{y}}{y} \]
        2. Applied rewrites79.6%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{0}{y} \cdot z, y, x\right)} \]
      10. Recombined 2 regimes into one program.
      11. Final simplification82.3%

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

      Alternative 5: 77.7% accurate, 6.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.52 \cdot 10^{+87} \lor \neg \left(y \leq 2.9 \cdot 10^{+61}\right):\\ \;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{0}{y} \cdot z, y, x\right)\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (if (or (<= y -1.52e+87) (not (<= y 2.9e+61)))
         (fma (- t x) z x)
         (fma (* (/ 0.0 y) z) y x)))
      double code(double x, double y, double z, double t) {
      	double tmp;
      	if ((y <= -1.52e+87) || !(y <= 2.9e+61)) {
      		tmp = fma((t - x), z, x);
      	} else {
      		tmp = fma(((0.0 / y) * z), y, x);
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	tmp = 0.0
      	if ((y <= -1.52e+87) || !(y <= 2.9e+61))
      		tmp = fma(Float64(t - x), z, x);
      	else
      		tmp = fma(Float64(Float64(0.0 / y) * z), y, x);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.52e+87], N[Not[LessEqual[y, 2.9e+61]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(N[(0.0 / y), $MachinePrecision] * z), $MachinePrecision] * y + x), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -1.52 \cdot 10^{+87} \lor \neg \left(y \leq 2.9 \cdot 10^{+61}\right):\\
      \;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(\frac{0}{y} \cdot z, y, x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -1.51999999999999991e87 or 2.9000000000000001e61 < y

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

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

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

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

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

        if -1.51999999999999991e87 < y < 2.9000000000000001e61

        1. Initial program 98.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-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) \]
          2. tanh-def-cN/A

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

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

            \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{\color{blue}{1 - e^{-2 \cdot \frac{x}{y}}}}{1 + e^{-2 \cdot \frac{x}{y}}}\right) \]
          5. exp-prodN/A

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

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

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

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

            \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{1 - {\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}}{\color{blue}{e^{-2 \cdot \frac{x}{y}} + 1}}\right) \]
          10. exp-prodN/A

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

            \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{1 - {\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}}{\color{blue}{{\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}} + 1}\right) \]
          12. lower-exp.f6464.6

            \[\leadsto x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{1 - {\left(e^{-2}\right)}^{\left(\frac{x}{y}\right)}}{{\color{blue}{\left(e^{-2}\right)}}^{\left(\frac{x}{y}\right)} + 1}\right) \]
        4. Applied rewrites64.6%

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

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

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

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

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

            \[\leadsto x + \left(y \cdot z\right) \cdot \frac{\frac{\left(x \cdot x\right) \cdot 0}{y}}{y} \]
          2. Applied rewrites75.7%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{0}{y} \cdot z, y, x\right)} \]
        10. Recombined 2 regimes into one program.
        11. Final simplification77.8%

          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.52 \cdot 10^{+87} \lor \neg \left(y \leq 2.9 \cdot 10^{+61}\right):\\ \;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{0}{y} \cdot z, y, x\right)\\ \end{array} \]
        12. Add Preprocessing

        Alternative 6: 65.0% accurate, 6.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(t - x, z, x\right)\\ \mathbf{if}\;y \leq -6.9 \cdot 10^{+53}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -4.8 \cdot 10^{-121}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t}{y} \cdot z, y, x\right)\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{-109}:\\ \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (x y z t)
         :precision binary64
         (let* ((t_1 (fma (- t x) z x)))
           (if (<= y -6.9e+53)
             t_1
             (if (<= y -4.8e-121)
               (fma (* (/ t y) z) y x)
               (if (<= y 7.2e-109) (fma (- x) z x) t_1)))))
        double code(double x, double y, double z, double t) {
        	double t_1 = fma((t - x), z, x);
        	double tmp;
        	if (y <= -6.9e+53) {
        		tmp = t_1;
        	} else if (y <= -4.8e-121) {
        		tmp = fma(((t / y) * z), y, x);
        	} else if (y <= 7.2e-109) {
        		tmp = fma(-x, z, x);
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        function code(x, y, z, t)
        	t_1 = fma(Float64(t - x), z, x)
        	tmp = 0.0
        	if (y <= -6.9e+53)
        		tmp = t_1;
        	elseif (y <= -4.8e-121)
        		tmp = fma(Float64(Float64(t / y) * z), y, x);
        	elseif (y <= 7.2e-109)
        		tmp = fma(Float64(-x), z, x);
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[y, -6.9e+53], t$95$1, If[LessEqual[y, -4.8e-121], N[(N[(N[(t / y), $MachinePrecision] * z), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[y, 7.2e-109], N[((-x) * z + x), $MachinePrecision], t$95$1]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \mathsf{fma}\left(t - x, z, x\right)\\
        \mathbf{if}\;y \leq -6.9 \cdot 10^{+53}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;y \leq -4.8 \cdot 10^{-121}:\\
        \;\;\;\;\mathsf{fma}\left(\frac{t}{y} \cdot z, y, x\right)\\
        
        \mathbf{elif}\;y \leq 7.2 \cdot 10^{-109}:\\
        \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if y < -6.9000000000000002e53 or 7.2000000000000001e-109 < y

          1. Initial program 82.2%

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

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

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

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

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

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

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

          if -6.9000000000000002e53 < y < -4.80000000000000007e-121

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if -4.80000000000000007e-121 < y < 7.2000000000000001e-109

            1. Initial program 98.8%

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

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

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

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

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

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

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

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

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

            Alternative 7: 64.6% accurate, 10.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{-121} \lor \neg \left(y \leq 7.2 \cdot 10^{-109}\right):\\ \;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\ \end{array} \end{array} \]
            (FPCore (x y z t)
             :precision binary64
             (if (or (<= y -7e-121) (not (<= y 7.2e-109)))
               (fma (- t x) z x)
               (fma (- x) z x)))
            double code(double x, double y, double z, double t) {
            	double tmp;
            	if ((y <= -7e-121) || !(y <= 7.2e-109)) {
            		tmp = fma((t - x), z, x);
            	} else {
            		tmp = fma(-x, z, x);
            	}
            	return tmp;
            }
            
            function code(x, y, z, t)
            	tmp = 0.0
            	if ((y <= -7e-121) || !(y <= 7.2e-109))
            		tmp = fma(Float64(t - x), z, x);
            	else
            		tmp = fma(Float64(-x), z, x);
            	end
            	return tmp
            end
            
            code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7e-121], N[Not[LessEqual[y, 7.2e-109]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision], N[((-x) * z + x), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq -7 \cdot 10^{-121} \lor \neg \left(y \leq 7.2 \cdot 10^{-109}\right):\\
            \;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -6.99999999999999985e-121 or 7.2000000000000001e-109 < y

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

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

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

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

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

              if -6.99999999999999985e-121 < y < 7.2000000000000001e-109

              1. Initial program 98.8%

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

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

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

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

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

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

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

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

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

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

              Alternative 8: 63.4% accurate, 11.4× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -7200 \lor \neg \left(z \leq 2600000000\right):\\ \;\;\;\;\left(t - x\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\ \end{array} \end{array} \]
              (FPCore (x y z t)
               :precision binary64
               (if (or (<= z -7200.0) (not (<= z 2600000000.0)))
                 (* (- t x) z)
                 (fma (- x) z x)))
              double code(double x, double y, double z, double t) {
              	double tmp;
              	if ((z <= -7200.0) || !(z <= 2600000000.0)) {
              		tmp = (t - x) * z;
              	} else {
              		tmp = fma(-x, z, x);
              	}
              	return tmp;
              }
              
              function code(x, y, z, t)
              	tmp = 0.0
              	if ((z <= -7200.0) || !(z <= 2600000000.0))
              		tmp = Float64(Float64(t - x) * z);
              	else
              		tmp = fma(Float64(-x), z, x);
              	end
              	return tmp
              end
              
              code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7200.0], N[Not[LessEqual[z, 2600000000.0]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision], N[((-x) * z + x), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;z \leq -7200 \lor \neg \left(z \leq 2600000000\right):\\
              \;\;\;\;\left(t - x\right) \cdot z\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if z < -7200 or 2.6e9 < z

                1. Initial program 82.0%

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

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

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

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

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

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

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

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

                    \[\leadsto z \cdot \color{blue}{t} \]
                  2. Taylor expanded in z around inf

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

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

                    if -7200 < z < 2.6e9

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

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

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

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

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

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

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7200 \lor \neg \left(z \leq 2600000000\right):\\ \;\;\;\;\left(t - x\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\ \end{array} \]
                    10. Add Preprocessing

                    Alternative 9: 20.6% accurate, 11.9× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.9 \cdot 10^{-22} \lor \neg \left(x \leq 2.8 \cdot 10^{-121}\right):\\ \;\;\;\;\left(-x\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \end{array} \]
                    (FPCore (x y z t)
                     :precision binary64
                     (if (or (<= x -3.9e-22) (not (<= x 2.8e-121))) (* (- x) z) (* z t)))
                    double code(double x, double y, double z, double t) {
                    	double tmp;
                    	if ((x <= -3.9e-22) || !(x <= 2.8e-121)) {
                    		tmp = -x * z;
                    	} else {
                    		tmp = z * t;
                    	}
                    	return tmp;
                    }
                    
                    module fmin_fmax_functions
                        implicit none
                        private
                        public fmax
                        public fmin
                    
                        interface fmax
                            module procedure fmax88
                            module procedure fmax44
                            module procedure fmax84
                            module procedure fmax48
                        end interface
                        interface fmin
                            module procedure fmin88
                            module procedure fmin44
                            module procedure fmin84
                            module procedure fmin48
                        end interface
                    contains
                        real(8) function fmax88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmax44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmax84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmax48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                        end function
                        real(8) function fmin88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmin44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmin84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmin48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                        end function
                    end module
                    
                    real(8) function code(x, y, z, t)
                    use fmin_fmax_functions
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        real(8), intent (in) :: z
                        real(8), intent (in) :: t
                        real(8) :: tmp
                        if ((x <= (-3.9d-22)) .or. (.not. (x <= 2.8d-121))) then
                            tmp = -x * z
                        else
                            tmp = z * t
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double x, double y, double z, double t) {
                    	double tmp;
                    	if ((x <= -3.9e-22) || !(x <= 2.8e-121)) {
                    		tmp = -x * z;
                    	} else {
                    		tmp = z * t;
                    	}
                    	return tmp;
                    }
                    
                    def code(x, y, z, t):
                    	tmp = 0
                    	if (x <= -3.9e-22) or not (x <= 2.8e-121):
                    		tmp = -x * z
                    	else:
                    		tmp = z * t
                    	return tmp
                    
                    function code(x, y, z, t)
                    	tmp = 0.0
                    	if ((x <= -3.9e-22) || !(x <= 2.8e-121))
                    		tmp = Float64(Float64(-x) * z);
                    	else
                    		tmp = Float64(z * t);
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, y, z, t)
                    	tmp = 0.0;
                    	if ((x <= -3.9e-22) || ~((x <= 2.8e-121)))
                    		tmp = -x * z;
                    	else
                    		tmp = z * t;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.9e-22], N[Not[LessEqual[x, 2.8e-121]], $MachinePrecision]], N[((-x) * z), $MachinePrecision], N[(z * t), $MachinePrecision]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;x \leq -3.9 \cdot 10^{-22} \lor \neg \left(x \leq 2.8 \cdot 10^{-121}\right):\\
                    \;\;\;\;\left(-x\right) \cdot z\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;z \cdot t\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if x < -3.89999999999999998e-22 or 2.8000000000000001e-121 < x

                      1. Initial program 93.3%

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

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

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

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

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

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

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

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

                          \[\leadsto z \cdot \color{blue}{t} \]
                        2. Taylor expanded in z around inf

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

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

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

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

                            if -3.89999999999999998e-22 < x < 2.8000000000000001e-121

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

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

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

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

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

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

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

                              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.9 \cdot 10^{-22} \lor \neg \left(x \leq 2.8 \cdot 10^{-121}\right):\\ \;\;\;\;\left(-x\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;z \cdot t\\ \end{array} \]
                            10. Add Preprocessing

                            Alternative 10: 26.4% accurate, 26.6× speedup?

                            \[\begin{array}{l} \\ \left(t - x\right) \cdot z \end{array} \]
                            (FPCore (x y z t) :precision binary64 (* (- t x) z))
                            double code(double x, double y, double z, double t) {
                            	return (t - x) * z;
                            }
                            
                            module fmin_fmax_functions
                                implicit none
                                private
                                public fmax
                                public fmin
                            
                                interface fmax
                                    module procedure fmax88
                                    module procedure fmax44
                                    module procedure fmax84
                                    module procedure fmax48
                                end interface
                                interface fmin
                                    module procedure fmin88
                                    module procedure fmin44
                                    module procedure fmin84
                                    module procedure fmin48
                                end interface
                            contains
                                real(8) function fmax88(x, y) result (res)
                                    real(8), intent (in) :: x
                                    real(8), intent (in) :: y
                                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                end function
                                real(4) function fmax44(x, y) result (res)
                                    real(4), intent (in) :: x
                                    real(4), intent (in) :: y
                                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                end function
                                real(8) function fmax84(x, y) result(res)
                                    real(8), intent (in) :: x
                                    real(4), intent (in) :: y
                                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                end function
                                real(8) function fmax48(x, y) result(res)
                                    real(4), intent (in) :: x
                                    real(8), intent (in) :: y
                                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                end function
                                real(8) function fmin88(x, y) result (res)
                                    real(8), intent (in) :: x
                                    real(8), intent (in) :: y
                                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                end function
                                real(4) function fmin44(x, y) result (res)
                                    real(4), intent (in) :: x
                                    real(4), intent (in) :: y
                                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                end function
                                real(8) function fmin84(x, y) result(res)
                                    real(8), intent (in) :: x
                                    real(4), intent (in) :: y
                                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                end function
                                real(8) function fmin48(x, y) result(res)
                                    real(4), intent (in) :: x
                                    real(8), intent (in) :: y
                                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                end function
                            end module
                            
                            real(8) function code(x, y, z, t)
                            use fmin_fmax_functions
                                real(8), intent (in) :: x
                                real(8), intent (in) :: y
                                real(8), intent (in) :: z
                                real(8), intent (in) :: t
                                code = (t - x) * z
                            end function
                            
                            public static double code(double x, double y, double z, double t) {
                            	return (t - x) * z;
                            }
                            
                            def code(x, y, z, t):
                            	return (t - x) * z
                            
                            function code(x, y, z, t)
                            	return Float64(Float64(t - x) * z)
                            end
                            
                            function tmp = code(x, y, z, t)
                            	tmp = (t - x) * z;
                            end
                            
                            code[x_, y_, z_, t_] := N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]
                            
                            \begin{array}{l}
                            
                            \\
                            \left(t - x\right) \cdot z
                            \end{array}
                            
                            Derivation
                            1. Initial program 90.5%

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

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

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

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

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

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

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

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

                                \[\leadsto z \cdot \color{blue}{t} \]
                              2. Taylor expanded in z around inf

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

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

                                Alternative 11: 17.0% accurate, 39.8× speedup?

                                \[\begin{array}{l} \\ z \cdot t \end{array} \]
                                (FPCore (x y z t) :precision binary64 (* z t))
                                double code(double x, double y, double z, double t) {
                                	return z * t;
                                }
                                
                                module fmin_fmax_functions
                                    implicit none
                                    private
                                    public fmax
                                    public fmin
                                
                                    interface fmax
                                        module procedure fmax88
                                        module procedure fmax44
                                        module procedure fmax84
                                        module procedure fmax48
                                    end interface
                                    interface fmin
                                        module procedure fmin88
                                        module procedure fmin44
                                        module procedure fmin84
                                        module procedure fmin48
                                    end interface
                                contains
                                    real(8) function fmax88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmax44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmax84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmax48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmin44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmin48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                    end function
                                end module
                                
                                real(8) function code(x, y, z, t)
                                use fmin_fmax_functions
                                    real(8), intent (in) :: x
                                    real(8), intent (in) :: y
                                    real(8), intent (in) :: z
                                    real(8), intent (in) :: t
                                    code = z * t
                                end function
                                
                                public static double code(double x, double y, double z, double t) {
                                	return z * t;
                                }
                                
                                def code(x, y, z, t):
                                	return z * t
                                
                                function code(x, y, z, t)
                                	return Float64(z * t)
                                end
                                
                                function tmp = code(x, y, z, t)
                                	tmp = z * t;
                                end
                                
                                code[x_, y_, z_, t_] := N[(z * t), $MachinePrecision]
                                
                                \begin{array}{l}
                                
                                \\
                                z \cdot t
                                \end{array}
                                
                                Derivation
                                1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

                                  Developer Target 1: 97.0% 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)))));
                                  }
                                  
                                  module fmin_fmax_functions
                                      implicit none
                                      private
                                      public fmax
                                      public fmin
                                  
                                      interface fmax
                                          module procedure fmax88
                                          module procedure fmax44
                                          module procedure fmax84
                                          module procedure fmax48
                                      end interface
                                      interface fmin
                                          module procedure fmin88
                                          module procedure fmin44
                                          module procedure fmin84
                                          module procedure fmin48
                                      end interface
                                  contains
                                      real(8) function fmax88(x, y) result (res)
                                          real(8), intent (in) :: x
                                          real(8), intent (in) :: y
                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                      end function
                                      real(4) function fmax44(x, y) result (res)
                                          real(4), intent (in) :: x
                                          real(4), intent (in) :: y
                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                      end function
                                      real(8) function fmax84(x, y) result(res)
                                          real(8), intent (in) :: x
                                          real(4), intent (in) :: y
                                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                      end function
                                      real(8) function fmax48(x, y) result(res)
                                          real(4), intent (in) :: x
                                          real(8), intent (in) :: y
                                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                      end function
                                      real(8) function fmin88(x, y) result (res)
                                          real(8), intent (in) :: x
                                          real(8), intent (in) :: y
                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                      end function
                                      real(4) function fmin44(x, y) result (res)
                                          real(4), intent (in) :: x
                                          real(4), intent (in) :: y
                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                      end function
                                      real(8) function fmin84(x, y) result(res)
                                          real(8), intent (in) :: x
                                          real(4), intent (in) :: y
                                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                      end function
                                      real(8) function fmin48(x, y) result(res)
                                          real(4), intent (in) :: x
                                          real(8), intent (in) :: y
                                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                      end function
                                  end module
                                  
                                  real(8) function code(x, y, z, t)
                                  use fmin_fmax_functions
                                      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 2024352 
                                  (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))))))