AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1

Percentage Accurate: 61.0% → 89.3%
Time: 9.7s
Alternatives: 6
Speedup: N/A×

Specification

?
\[\begin{array}{l} \\ \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
	return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + 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, a, b)
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), intent (in) :: a
    real(8), intent (in) :: b
    code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b):
	return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\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 6 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: 61.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
	return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + 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, a, b)
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), intent (in) :: a
    real(8), intent (in) :: b
    code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b):
	return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 89.3% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := {\left(t + y\right)}^{2}\\ t_2 := \frac{z}{t + y}\\ t_3 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\ t_4 := \left(\mathsf{fma}\left(\left(\mathsf{fma}\left(b, \frac{y}{t\_1}, t\_2\right) - \frac{a}{t + y}\right) - y \cdot \frac{z}{t\_1}, x, y \cdot t\_2\right) - -1 \cdot a\right) - b \cdot \frac{y}{t + y}\\ \mathbf{if}\;t\_3 \leq -\infty:\\ \;\;\;\;t\_4\\ \mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+300}:\\ \;\;\;\;t\_3\\ \mathbf{else}:\\ \;\;\;\;t\_4\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (pow (+ t y) 2.0))
        (t_2 (/ z (+ t y)))
        (t_3 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
        (t_4
         (-
          (-
           (fma
            (- (- (fma b (/ y t_1) t_2) (/ a (+ t y))) (* y (/ z t_1)))
            x
            (* y t_2))
           (* -1.0 a))
          (* b (/ y (+ t y))))))
   (if (<= t_3 (- INFINITY)) t_4 (if (<= t_3 5e+300) t_3 t_4))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = pow((t + y), 2.0);
	double t_2 = z / (t + y);
	double t_3 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
	double t_4 = (fma(((fma(b, (y / t_1), t_2) - (a / (t + y))) - (y * (z / t_1))), x, (y * t_2)) - (-1.0 * a)) - (b * (y / (t + y)));
	double tmp;
	if (t_3 <= -((double) INFINITY)) {
		tmp = t_4;
	} else if (t_3 <= 5e+300) {
		tmp = t_3;
	} else {
		tmp = t_4;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(t + y) ^ 2.0
	t_2 = Float64(z / Float64(t + y))
	t_3 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y))
	t_4 = Float64(Float64(fma(Float64(Float64(fma(b, Float64(y / t_1), t_2) - Float64(a / Float64(t + y))) - Float64(y * Float64(z / t_1))), x, Float64(y * t_2)) - Float64(-1.0 * a)) - Float64(b * Float64(y / Float64(t + y))))
	tmp = 0.0
	if (t_3 <= Float64(-Inf))
		tmp = t_4;
	elseif (t_3 <= 5e+300)
		tmp = t_3;
	else
		tmp = t_4;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Power[N[(t + y), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(z / N[(t + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(N[(N[(N[(b * N[(y / t$95$1), $MachinePrecision] + t$95$2), $MachinePrecision] - N[(a / N[(t + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x + N[(y * t$95$2), $MachinePrecision]), $MachinePrecision] - N[(-1.0 * a), $MachinePrecision]), $MachinePrecision] - N[(b * N[(y / N[(t + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$4, If[LessEqual[t$95$3, 5e+300], t$95$3, t$95$4]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := {\left(t + y\right)}^{2}\\
t_2 := \frac{z}{t + y}\\
t_3 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_4 := \left(\mathsf{fma}\left(\left(\mathsf{fma}\left(b, \frac{y}{t\_1}, t\_2\right) - \frac{a}{t + y}\right) - y \cdot \frac{z}{t\_1}, x, y \cdot t\_2\right) - -1 \cdot a\right) - b \cdot \frac{y}{t + y}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_4\\

\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+300}:\\
\;\;\;\;t\_3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 5.00000000000000026e300 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y))

    1. Initial program 5.2%

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

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

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

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

    if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.00000000000000026e300

    1. Initial program 99.1%

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification89.4%

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

Alternative 2: 84.2% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := {\left(t + y\right)}^{2}\\ t_2 := \frac{z}{t + y}\\ t_3 := \left(y + x\right) + t\\ t_4 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\ \mathbf{if}\;t\_4 \leq -\infty \lor \neg \left(t\_4 \leq 5 \cdot 10^{+300}\right):\\ \;\;\;\;\left(\mathsf{fma}\left(\left(\mathsf{fma}\left(b, \frac{y}{t\_1}, t\_2\right) - \frac{a}{t + y}\right) - y \cdot \frac{z}{t\_1}, x, y \cdot t\_2\right) - -1 \cdot a\right) - b \cdot \frac{y}{t + y}\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(y + x, z, \left(-1 \cdot b\right) \cdot y\right)}{t\_3}}{a}, -1, \frac{-1 \cdot \left(t + y\right)}{t\_3}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (pow (+ t y) 2.0))
        (t_2 (/ z (+ t y)))
        (t_3 (+ (+ y x) t))
        (t_4 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))))
   (if (or (<= t_4 (- INFINITY)) (not (<= t_4 5e+300)))
     (-
      (-
       (fma
        (- (- (fma b (/ y t_1) t_2) (/ a (+ t y))) (* y (/ z t_1)))
        x
        (* y t_2))
       (* -1.0 a))
      (* b (/ y (+ t y))))
     (*
      (* -1.0 a)
      (fma
       (/ (/ (fma (+ y x) z (* (* -1.0 b) y)) t_3) a)
       -1.0
       (/ (* -1.0 (+ t y)) t_3))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = pow((t + y), 2.0);
	double t_2 = z / (t + y);
	double t_3 = (y + x) + t;
	double t_4 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
	double tmp;
	if ((t_4 <= -((double) INFINITY)) || !(t_4 <= 5e+300)) {
		tmp = (fma(((fma(b, (y / t_1), t_2) - (a / (t + y))) - (y * (z / t_1))), x, (y * t_2)) - (-1.0 * a)) - (b * (y / (t + y)));
	} else {
		tmp = (-1.0 * a) * fma(((fma((y + x), z, ((-1.0 * b) * y)) / t_3) / a), -1.0, ((-1.0 * (t + y)) / t_3));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(t + y) ^ 2.0
	t_2 = Float64(z / Float64(t + y))
	t_3 = Float64(Float64(y + x) + t)
	t_4 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y))
	tmp = 0.0
	if ((t_4 <= Float64(-Inf)) || !(t_4 <= 5e+300))
		tmp = Float64(Float64(fma(Float64(Float64(fma(b, Float64(y / t_1), t_2) - Float64(a / Float64(t + y))) - Float64(y * Float64(z / t_1))), x, Float64(y * t_2)) - Float64(-1.0 * a)) - Float64(b * Float64(y / Float64(t + y))));
	else
		tmp = Float64(Float64(-1.0 * a) * fma(Float64(Float64(fma(Float64(y + x), z, Float64(Float64(-1.0 * b) * y)) / t_3) / a), -1.0, Float64(Float64(-1.0 * Float64(t + y)) / t_3)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Power[N[(t + y), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(z / N[(t + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$4, (-Infinity)], N[Not[LessEqual[t$95$4, 5e+300]], $MachinePrecision]], N[(N[(N[(N[(N[(N[(b * N[(y / t$95$1), $MachinePrecision] + t$95$2), $MachinePrecision] - N[(a / N[(t + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x + N[(y * t$95$2), $MachinePrecision]), $MachinePrecision] - N[(-1.0 * a), $MachinePrecision]), $MachinePrecision] - N[(b * N[(y / N[(t + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * a), $MachinePrecision] * N[(N[(N[(N[(N[(y + x), $MachinePrecision] * z + N[(N[(-1.0 * b), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision] / a), $MachinePrecision] * -1.0 + N[(N[(-1.0 * N[(t + y), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := {\left(t + y\right)}^{2}\\
t_2 := \frac{z}{t + y}\\
t_3 := \left(y + x\right) + t\\
t_4 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
\mathbf{if}\;t\_4 \leq -\infty \lor \neg \left(t\_4 \leq 5 \cdot 10^{+300}\right):\\
\;\;\;\;\left(\mathsf{fma}\left(\left(\mathsf{fma}\left(b, \frac{y}{t\_1}, t\_2\right) - \frac{a}{t + y}\right) - y \cdot \frac{z}{t\_1}, x, y \cdot t\_2\right) - -1 \cdot a\right) - b \cdot \frac{y}{t + y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 5.00000000000000026e300 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y))

    1. Initial program 5.2%

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

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

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

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

    if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.00000000000000026e300

    1. Initial program 99.1%

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

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(-1 \cdot \frac{t + y}{t + \left(x + y\right)} + -1 \cdot \frac{\frac{z \cdot \left(x + y\right)}{t + \left(x + y\right)} - \frac{b \cdot y}{t + \left(x + y\right)}}{a}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

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

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

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

Alternative 3: 83.1% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{y}{{\left(y + x\right)}^{2}}\\ t_2 := \left(y + x\right) + t\\ t_3 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\ t_4 := \frac{y}{y + x}\\ \mathbf{if}\;t\_3 \leq -\infty \lor \neg \left(t\_3 \leq 5 \cdot 10^{+300}\right):\\ \;\;\;\;z + \left(\mathsf{fma}\left(\left(\mathsf{fma}\left(b, t\_1, \frac{a}{y + x}\right) - \frac{z}{y + x}\right) - a \cdot t\_1, t, a \cdot t\_4\right) - b \cdot t\_4\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(y + x, z, \left(-1 \cdot b\right) \cdot y\right)}{t\_2}}{a}, -1, \frac{-1 \cdot \left(t + y\right)}{t\_2}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (/ y (pow (+ y x) 2.0)))
        (t_2 (+ (+ y x) t))
        (t_3 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
        (t_4 (/ y (+ y x))))
   (if (or (<= t_3 (- INFINITY)) (not (<= t_3 5e+300)))
     (+
      z
      (-
       (fma
        (- (- (fma b t_1 (/ a (+ y x))) (/ z (+ y x))) (* a t_1))
        t
        (* a t_4))
       (* b t_4)))
     (*
      (* -1.0 a)
      (fma
       (/ (/ (fma (+ y x) z (* (* -1.0 b) y)) t_2) a)
       -1.0
       (/ (* -1.0 (+ t y)) t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = y / pow((y + x), 2.0);
	double t_2 = (y + x) + t;
	double t_3 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
	double t_4 = y / (y + x);
	double tmp;
	if ((t_3 <= -((double) INFINITY)) || !(t_3 <= 5e+300)) {
		tmp = z + (fma(((fma(b, t_1, (a / (y + x))) - (z / (y + x))) - (a * t_1)), t, (a * t_4)) - (b * t_4));
	} else {
		tmp = (-1.0 * a) * fma(((fma((y + x), z, ((-1.0 * b) * y)) / t_2) / a), -1.0, ((-1.0 * (t + y)) / t_2));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(y / (Float64(y + x) ^ 2.0))
	t_2 = Float64(Float64(y + x) + t)
	t_3 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y))
	t_4 = Float64(y / Float64(y + x))
	tmp = 0.0
	if ((t_3 <= Float64(-Inf)) || !(t_3 <= 5e+300))
		tmp = Float64(z + Float64(fma(Float64(Float64(fma(b, t_1, Float64(a / Float64(y + x))) - Float64(z / Float64(y + x))) - Float64(a * t_1)), t, Float64(a * t_4)) - Float64(b * t_4)));
	else
		tmp = Float64(Float64(-1.0 * a) * fma(Float64(Float64(fma(Float64(y + x), z, Float64(Float64(-1.0 * b) * y)) / t_2) / a), -1.0, Float64(Float64(-1.0 * Float64(t + y)) / t_2)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y / N[Power[N[(y + x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$3, (-Infinity)], N[Not[LessEqual[t$95$3, 5e+300]], $MachinePrecision]], N[(z + N[(N[(N[(N[(N[(b * t$95$1 + N[(a / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * t$95$1), $MachinePrecision]), $MachinePrecision] * t + N[(a * t$95$4), $MachinePrecision]), $MachinePrecision] - N[(b * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * a), $MachinePrecision] * N[(N[(N[(N[(N[(y + x), $MachinePrecision] * z + N[(N[(-1.0 * b), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] / a), $MachinePrecision] * -1.0 + N[(N[(-1.0 * N[(t + y), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{y}{{\left(y + x\right)}^{2}}\\
t_2 := \left(y + x\right) + t\\
t_3 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_4 := \frac{y}{y + x}\\
\mathbf{if}\;t\_3 \leq -\infty \lor \neg \left(t\_3 \leq 5 \cdot 10^{+300}\right):\\
\;\;\;\;z + \left(\mathsf{fma}\left(\left(\mathsf{fma}\left(b, t\_1, \frac{a}{y + x}\right) - \frac{z}{y + x}\right) - a \cdot t\_1, t, a \cdot t\_4\right) - b \cdot t\_4\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 5.00000000000000026e300 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y))

    1. Initial program 5.2%

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

      \[\leadsto \color{blue}{\left(z + \left(t \cdot \left(\left(\frac{a}{x + y} + \frac{b \cdot y}{{\left(x + y\right)}^{2}}\right) - \left(\frac{z}{x + y} + \frac{a \cdot y}{{\left(x + y\right)}^{2}}\right)\right) + \frac{a \cdot y}{x + y}\right)\right) - \frac{b \cdot y}{x + y}} \]
    4. Step-by-step derivation
      1. associate--l+N/A

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

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

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

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

    if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.00000000000000026e300

    1. Initial program 99.1%

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

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(-1 \cdot \frac{t + y}{t + \left(x + y\right)} + -1 \cdot \frac{\frac{z \cdot \left(x + y\right)}{t + \left(x + y\right)} - \frac{b \cdot y}{t + \left(x + y\right)}}{a}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

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

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

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

Alternative 4: 81.4% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y + x\right) + t\\ t_2 := -1 \cdot \frac{y}{t\_1}\\ \mathbf{if}\;z \leq -1.75 \cdot 10^{+74} \lor \neg \left(z \leq 7.8 \cdot 10^{-47}\right):\\ \;\;\;\;\left(\left(\left(\frac{\frac{\left(t + y\right) \cdot a}{z}}{t\_1} - t\_2\right) + \frac{x}{t\_1}\right) - \left(-1 \cdot \frac{b}{z}\right) \cdot t\_2\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(y + x, z, \left(-1 \cdot b\right) \cdot y\right)}{t\_1}}{a}, -1, \frac{-1 \cdot \left(t + y\right)}{t\_1}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ (+ y x) t)) (t_2 (* -1.0 (/ y t_1))))
   (if (or (<= z -1.75e+74) (not (<= z 7.8e-47)))
     (*
      (-
       (+ (- (/ (/ (* (+ t y) a) z) t_1) t_2) (/ x t_1))
       (* (* -1.0 (/ b z)) t_2))
      z)
     (*
      (* -1.0 a)
      (fma
       (/ (/ (fma (+ y x) z (* (* -1.0 b) y)) t_1) a)
       -1.0
       (/ (* -1.0 (+ t y)) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (y + x) + t;
	double t_2 = -1.0 * (y / t_1);
	double tmp;
	if ((z <= -1.75e+74) || !(z <= 7.8e-47)) {
		tmp = (((((((t + y) * a) / z) / t_1) - t_2) + (x / t_1)) - ((-1.0 * (b / z)) * t_2)) * z;
	} else {
		tmp = (-1.0 * a) * fma(((fma((y + x), z, ((-1.0 * b) * y)) / t_1) / a), -1.0, ((-1.0 * (t + y)) / t_1));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(y + x) + t)
	t_2 = Float64(-1.0 * Float64(y / t_1))
	tmp = 0.0
	if ((z <= -1.75e+74) || !(z <= 7.8e-47))
		tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(t + y) * a) / z) / t_1) - t_2) + Float64(x / t_1)) - Float64(Float64(-1.0 * Float64(b / z)) * t_2)) * z);
	else
		tmp = Float64(Float64(-1.0 * a) * fma(Float64(Float64(fma(Float64(y + x), z, Float64(Float64(-1.0 * b) * y)) / t_1) / a), -1.0, Float64(Float64(-1.0 * Float64(t + y)) / t_1)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$2 = N[(-1.0 * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[z, -1.75e+74], N[Not[LessEqual[z, 7.8e-47]], $MachinePrecision]], N[(N[(N[(N[(N[(N[(N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision] / z), $MachinePrecision] / t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision] + N[(x / t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 * N[(b / z), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[(-1.0 * a), $MachinePrecision] * N[(N[(N[(N[(N[(y + x), $MachinePrecision] * z + N[(N[(-1.0 * b), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] / a), $MachinePrecision] * -1.0 + N[(N[(-1.0 * N[(t + y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(y + x\right) + t\\
t_2 := -1 \cdot \frac{y}{t\_1}\\
\mathbf{if}\;z \leq -1.75 \cdot 10^{+74} \lor \neg \left(z \leq 7.8 \cdot 10^{-47}\right):\\
\;\;\;\;\left(\left(\left(\frac{\frac{\left(t + y\right) \cdot a}{z}}{t\_1} - t\_2\right) + \frac{x}{t\_1}\right) - \left(-1 \cdot \frac{b}{z}\right) \cdot t\_2\right) \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.75000000000000007e74 or 7.79999999999999956e-47 < z

    1. Initial program 40.4%

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

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

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

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

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

    if -1.75000000000000007e74 < z < 7.79999999999999956e-47

    1. Initial program 67.7%

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

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(-1 \cdot \frac{t + y}{t + \left(x + y\right)} + -1 \cdot \frac{\frac{z \cdot \left(x + y\right)}{t + \left(x + y\right)} - \frac{b \cdot y}{t + \left(x + y\right)}}{a}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

        \[\leadsto \left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{\frac{z \cdot \left(x + y\right)}{t + \left(x + y\right)} - \frac{b \cdot y}{t + \left(x + y\right)}}{a}, \color{blue}{-1}, -1 \cdot \frac{t + y}{t + \left(x + y\right)}\right) \]
    5. Applied rewrites84.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.75 \cdot 10^{+74} \lor \neg \left(z \leq 7.8 \cdot 10^{-47}\right):\\ \;\;\;\;\left(\left(\left(\frac{\frac{\left(t + y\right) \cdot a}{z}}{\left(y + x\right) + t} - -1 \cdot \frac{y}{\left(y + x\right) + t}\right) + \frac{x}{\left(y + x\right) + t}\right) - \left(-1 \cdot \frac{b}{z}\right) \cdot \left(-1 \cdot \frac{y}{\left(y + x\right) + t}\right)\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(y + x, z, \left(-1 \cdot b\right) \cdot y\right)}{\left(y + x\right) + t}}{a}, -1, \frac{-1 \cdot \left(t + y\right)}{\left(y + x\right) + t}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 80.1% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y + x\right) + t\\ \mathbf{if}\;z \leq -8.5 \cdot 10^{+87} \lor \neg \left(z \leq 7.8 \cdot 10^{-47}\right):\\ \;\;\;\;\left(\left(\left(\frac{\frac{\left(t + y\right) \cdot a}{z}}{t\_1} - -1 \cdot \frac{y}{t\_1}\right) + \frac{x}{t\_1}\right) - \left(-1 \cdot \frac{b}{z}\right) \cdot \frac{-1 \cdot y}{-1 \cdot \left(x \cdot \left(-1 \cdot \frac{t + y}{x} - 1\right)\right)}\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(y + x, z, \left(-1 \cdot b\right) \cdot y\right)}{t\_1}}{a}, -1, \frac{-1 \cdot \left(t + y\right)}{t\_1}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ (+ y x) t)))
   (if (or (<= z -8.5e+87) (not (<= z 7.8e-47)))
     (*
      (-
       (+ (- (/ (/ (* (+ t y) a) z) t_1) (* -1.0 (/ y t_1))) (/ x t_1))
       (*
        (* -1.0 (/ b z))
        (/ (* -1.0 y) (* -1.0 (* x (- (* -1.0 (/ (+ t y) x)) 1.0))))))
      z)
     (*
      (* -1.0 a)
      (fma
       (/ (/ (fma (+ y x) z (* (* -1.0 b) y)) t_1) a)
       -1.0
       (/ (* -1.0 (+ t y)) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (y + x) + t;
	double tmp;
	if ((z <= -8.5e+87) || !(z <= 7.8e-47)) {
		tmp = (((((((t + y) * a) / z) / t_1) - (-1.0 * (y / t_1))) + (x / t_1)) - ((-1.0 * (b / z)) * ((-1.0 * y) / (-1.0 * (x * ((-1.0 * ((t + y) / x)) - 1.0)))))) * z;
	} else {
		tmp = (-1.0 * a) * fma(((fma((y + x), z, ((-1.0 * b) * y)) / t_1) / a), -1.0, ((-1.0 * (t + y)) / t_1));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(y + x) + t)
	tmp = 0.0
	if ((z <= -8.5e+87) || !(z <= 7.8e-47))
		tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(t + y) * a) / z) / t_1) - Float64(-1.0 * Float64(y / t_1))) + Float64(x / t_1)) - Float64(Float64(-1.0 * Float64(b / z)) * Float64(Float64(-1.0 * y) / Float64(-1.0 * Float64(x * Float64(Float64(-1.0 * Float64(Float64(t + y) / x)) - 1.0)))))) * z);
	else
		tmp = Float64(Float64(-1.0 * a) * fma(Float64(Float64(fma(Float64(y + x), z, Float64(Float64(-1.0 * b) * y)) / t_1) / a), -1.0, Float64(Float64(-1.0 * Float64(t + y)) / t_1)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, If[Or[LessEqual[z, -8.5e+87], N[Not[LessEqual[z, 7.8e-47]], $MachinePrecision]], N[(N[(N[(N[(N[(N[(N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision] / z), $MachinePrecision] / t$95$1), $MachinePrecision] - N[(-1.0 * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 * N[(b / z), $MachinePrecision]), $MachinePrecision] * N[(N[(-1.0 * y), $MachinePrecision] / N[(-1.0 * N[(x * N[(N[(-1.0 * N[(N[(t + y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[(-1.0 * a), $MachinePrecision] * N[(N[(N[(N[(N[(y + x), $MachinePrecision] * z + N[(N[(-1.0 * b), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] / a), $MachinePrecision] * -1.0 + N[(N[(-1.0 * N[(t + y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(y + x\right) + t\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+87} \lor \neg \left(z \leq 7.8 \cdot 10^{-47}\right):\\
\;\;\;\;\left(\left(\left(\frac{\frac{\left(t + y\right) \cdot a}{z}}{t\_1} - -1 \cdot \frac{y}{t\_1}\right) + \frac{x}{t\_1}\right) - \left(-1 \cdot \frac{b}{z}\right) \cdot \frac{-1 \cdot y}{-1 \cdot \left(x \cdot \left(-1 \cdot \frac{t + y}{x} - 1\right)\right)}\right) \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -8.5000000000000001e87 or 7.79999999999999956e-47 < z

    1. Initial program 40.2%

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(\frac{\frac{\left(t + y\right) \cdot a}{z}}{\left(y + x\right) + t} + \frac{y}{\left(y + x\right) + t}\right) + \frac{x}{\left(y + x\right) + t}\right) - \frac{b}{z} \cdot \frac{y}{-1 \cdot \left(x \cdot \left(-1 \cdot \frac{t + y}{x} - 1\right)\right)}\right) \cdot z \]
      2. lower-*.f64N/A

        \[\leadsto \left(\left(\left(\frac{\frac{\left(t + y\right) \cdot a}{z}}{\left(y + x\right) + t} + \frac{y}{\left(y + x\right) + t}\right) + \frac{x}{\left(y + x\right) + t}\right) - \frac{b}{z} \cdot \frac{y}{-1 \cdot \left(x \cdot \left(-1 \cdot \frac{t + y}{x} - 1\right)\right)}\right) \cdot z \]
      3. lower--.f64N/A

        \[\leadsto \left(\left(\left(\frac{\frac{\left(t + y\right) \cdot a}{z}}{\left(y + x\right) + t} + \frac{y}{\left(y + x\right) + t}\right) + \frac{x}{\left(y + x\right) + t}\right) - \frac{b}{z} \cdot \frac{y}{-1 \cdot \left(x \cdot \left(-1 \cdot \frac{t + y}{x} - 1\right)\right)}\right) \cdot z \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left(\left(\frac{\frac{\left(t + y\right) \cdot a}{z}}{\left(y + x\right) + t} + \frac{y}{\left(y + x\right) + t}\right) + \frac{x}{\left(y + x\right) + t}\right) - \frac{b}{z} \cdot \frac{y}{-1 \cdot \left(x \cdot \left(-1 \cdot \frac{t + y}{x} - 1\right)\right)}\right) \cdot z \]
      5. lower-/.f64N/A

        \[\leadsto \left(\left(\left(\frac{\frac{\left(t + y\right) \cdot a}{z}}{\left(y + x\right) + t} + \frac{y}{\left(y + x\right) + t}\right) + \frac{x}{\left(y + x\right) + t}\right) - \frac{b}{z} \cdot \frac{y}{-1 \cdot \left(x \cdot \left(-1 \cdot \frac{t + y}{x} - 1\right)\right)}\right) \cdot z \]
      6. lift-+.f6479.8

        \[\leadsto \left(\left(\left(\frac{\frac{\left(t + y\right) \cdot a}{z}}{\left(y + x\right) + t} + \frac{y}{\left(y + x\right) + t}\right) + \frac{x}{\left(y + x\right) + t}\right) - \frac{b}{z} \cdot \frac{y}{-1 \cdot \left(x \cdot \left(-1 \cdot \frac{t + y}{x} - 1\right)\right)}\right) \cdot z \]
    8. Applied rewrites79.8%

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

    if -8.5000000000000001e87 < z < 7.79999999999999956e-47

    1. Initial program 67.4%

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

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(-1 \cdot \frac{t + y}{t + \left(x + y\right)} + -1 \cdot \frac{\frac{z \cdot \left(x + y\right)}{t + \left(x + y\right)} - \frac{b \cdot y}{t + \left(x + y\right)}}{a}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

        \[\leadsto \left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{\frac{z \cdot \left(x + y\right)}{t + \left(x + y\right)} - \frac{b \cdot y}{t + \left(x + y\right)}}{a}, \color{blue}{-1}, -1 \cdot \frac{t + y}{t + \left(x + y\right)}\right) \]
    5. Applied rewrites83.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.5 \cdot 10^{+87} \lor \neg \left(z \leq 7.8 \cdot 10^{-47}\right):\\ \;\;\;\;\left(\left(\left(\frac{\frac{\left(t + y\right) \cdot a}{z}}{\left(y + x\right) + t} - -1 \cdot \frac{y}{\left(y + x\right) + t}\right) + \frac{x}{\left(y + x\right) + t}\right) - \left(-1 \cdot \frac{b}{z}\right) \cdot \frac{-1 \cdot y}{-1 \cdot \left(x \cdot \left(-1 \cdot \frac{t + y}{x} - 1\right)\right)}\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(y + x, z, \left(-1 \cdot b\right) \cdot y\right)}{\left(y + x\right) + t}}{a}, -1, \frac{-1 \cdot \left(t + y\right)}{\left(y + x\right) + t}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 67.8% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y + x\right) + t\\ \left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(y + x, z, \left(-1 \cdot b\right) \cdot y\right)}{t\_1}}{a}, -1, \frac{-1 \cdot \left(t + y\right)}{t\_1}\right) \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ (+ y x) t)))
   (*
    (* -1.0 a)
    (fma
     (/ (/ (fma (+ y x) z (* (* -1.0 b) y)) t_1) a)
     -1.0
     (/ (* -1.0 (+ t y)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (y + x) + t;
	return (-1.0 * a) * fma(((fma((y + x), z, ((-1.0 * b) * y)) / t_1) / a), -1.0, ((-1.0 * (t + y)) / t_1));
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(y + x) + t)
	return Float64(Float64(-1.0 * a) * fma(Float64(Float64(fma(Float64(y + x), z, Float64(Float64(-1.0 * b) * y)) / t_1) / a), -1.0, Float64(Float64(-1.0 * Float64(t + y)) / t_1)))
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, N[(N[(-1.0 * a), $MachinePrecision] * N[(N[(N[(N[(N[(y + x), $MachinePrecision] * z + N[(N[(-1.0 * b), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] / a), $MachinePrecision] * -1.0 + N[(N[(-1.0 * N[(t + y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(y + x\right) + t\\
\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(y + x, z, \left(-1 \cdot b\right) \cdot y\right)}{t\_1}}{a}, -1, \frac{-1 \cdot \left(t + y\right)}{t\_1}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 55.4%

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

    \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(-1 \cdot \frac{t + y}{t + \left(x + y\right)} + -1 \cdot \frac{\frac{z \cdot \left(x + y\right)}{t + \left(x + y\right)} - \frac{b \cdot y}{t + \left(x + y\right)}}{a}\right)\right)} \]
  4. Step-by-step derivation
    1. associate-*r*N/A

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

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

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

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

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

      \[\leadsto \left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{\frac{z \cdot \left(x + y\right)}{t + \left(x + y\right)} - \frac{b \cdot y}{t + \left(x + y\right)}}{a}, \color{blue}{-1}, -1 \cdot \frac{t + y}{t + \left(x + y\right)}\right) \]
  5. Applied rewrites64.2%

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

Reproduce

?
herbie shell --seed 2025065 
(FPCore (x y z t a b)
  :name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) -3581311708415056400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 12285964308315609000000000000000000000000000000000000000000000000000000000000000000) (/ 1 (/ (+ (+ x t) y) (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))) (- (+ z a) b))))

  (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))