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

Percentage Accurate: 61.0% → 97.4%
Time: 15.4s
Alternatives: 12
Speedup: 0.5×

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}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 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: 97.4% accurate, 0.5× speedup?

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(z, \frac{x}{t + \left(x + y\right)} + \frac{y}{t + \left(x + y\right)}, \frac{t + y}{t + \left(x + y\right)} \cdot a\right) - \frac{b \cdot y}{t + \left(x + y\right)} \]
  5. Applied rewrites97.4%

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

Alternative 2: 95.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\ t_2 := t + \left(x + y\right)\\ t_3 := \frac{x}{t\_2} + \frac{y}{t\_2}\\ \mathbf{if}\;t\_1 \leq -4 \cdot 10^{+184}:\\ \;\;\;\;\mathsf{fma}\left(z, t\_3, a\right) - \frac{b}{t\_2} \cdot y\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+270}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t\_3, \frac{t + y}{t\_2} \cdot a\right) - b\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
        (t_2 (+ t (+ x y)))
        (t_3 (+ (/ x t_2) (/ y t_2))))
   (if (<= t_1 -4e+184)
     (- (fma z t_3 a) (* (/ b t_2) y))
     (if (<= t_1 2e+270) t_1 (- (fma z t_3 (* (/ (+ t y) t_2) a)) b)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
	double t_2 = t + (x + y);
	double t_3 = (x / t_2) + (y / t_2);
	double tmp;
	if (t_1 <= -4e+184) {
		tmp = fma(z, t_3, a) - ((b / t_2) * y);
	} else if (t_1 <= 2e+270) {
		tmp = t_1;
	} else {
		tmp = fma(z, t_3, (((t + y) / t_2) * a)) - b;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y))
	t_2 = Float64(t + Float64(x + y))
	t_3 = Float64(Float64(x / t_2) + Float64(y / t_2))
	tmp = 0.0
	if (t_1 <= -4e+184)
		tmp = Float64(fma(z, t_3, a) - Float64(Float64(b / t_2) * y));
	elseif (t_1 <= 2e+270)
		tmp = t_1;
	else
		tmp = Float64(fma(z, t_3, Float64(Float64(Float64(t + y) / t_2) * a)) - b);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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$2 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x / t$95$2), $MachinePrecision] + N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+184], N[(N[(z * t$95$3 + a), $MachinePrecision] - N[(N[(b / t$95$2), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+270], t$95$1, N[(N[(z * t$95$3 + N[(N[(N[(t + y), $MachinePrecision] / t$95$2), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+270}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.00000000000000007e184

    1. Initial program 61.0%

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \frac{x}{t + \left(x + y\right)} + \frac{y}{t + \left(x + y\right)}, \frac{t + y}{t + \left(x + y\right)} \cdot a\right) - \frac{b \cdot y}{t + \left(x + y\right)} \]
    5. Applied rewrites97.4%

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

      \[\leadsto \mathsf{fma}\left(z, \frac{x}{t + \left(x + y\right)} + \frac{y}{t + \left(x + y\right)}, a\right) - \frac{b}{t + \left(x + y\right)} \cdot y \]
    7. Applied rewrites82.6%

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

    if -4.00000000000000007e184 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e270

    1. Initial program 61.0%

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

    if 2.0000000000000001e270 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y))

    1. Initial program 61.0%

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \frac{x}{t + \left(x + y\right)} + \frac{y}{t + \left(x + y\right)}, \frac{t + y}{t + \left(x + y\right)} \cdot a\right) - b \]
    6. Applied rewrites71.0%

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

Alternative 3: 93.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\ t_2 := t + \left(x + y\right)\\ t_3 := \mathsf{fma}\left(z, \frac{x}{t\_2} + \frac{y}{t\_2}, a\right) - \frac{b}{t\_2} \cdot y\\ \mathbf{if}\;t\_1 \leq -4 \cdot 10^{+184}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+270}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
        (t_2 (+ t (+ x y)))
        (t_3 (- (fma z (+ (/ x t_2) (/ y t_2)) a) (* (/ b t_2) y))))
   (if (<= t_1 -4e+184) t_3 (if (<= t_1 2e+270) t_1 t_3))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
	double t_2 = t + (x + y);
	double t_3 = fma(z, ((x / t_2) + (y / t_2)), a) - ((b / t_2) * y);
	double tmp;
	if (t_1 <= -4e+184) {
		tmp = t_3;
	} else if (t_1 <= 2e+270) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y))
	t_2 = Float64(t + Float64(x + y))
	t_3 = Float64(fma(z, Float64(Float64(x / t_2) + Float64(y / t_2)), a) - Float64(Float64(b / t_2) * y))
	tmp = 0.0
	if (t_1 <= -4e+184)
		tmp = t_3;
	elseif (t_1 <= 2e+270)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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$2 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(z * N[(N[(x / t$95$2), $MachinePrecision] + N[(y / t$95$2), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision] - N[(N[(b / t$95$2), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+184], t$95$3, If[LessEqual[t$95$1, 2e+270], t$95$1, t$95$3]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+270}:\\
\;\;\;\;t\_1\\

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


\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)) < -4.00000000000000007e184 or 2.0000000000000001e270 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y))

    1. Initial program 61.0%

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \frac{x}{t + \left(x + y\right)} + \frac{y}{t + \left(x + y\right)}, \frac{t + y}{t + \left(x + y\right)} \cdot a\right) - \frac{b \cdot y}{t + \left(x + y\right)} \]
    5. Applied rewrites97.4%

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

      \[\leadsto \mathsf{fma}\left(z, \frac{x}{t + \left(x + y\right)} + \frac{y}{t + \left(x + y\right)}, a\right) - \frac{b}{t + \left(x + y\right)} \cdot y \]
    7. Applied rewrites82.6%

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

    if -4.00000000000000007e184 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e270

    1. Initial program 61.0%

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

Alternative 4: 91.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\ t_2 := \left(a + z\right) - \frac{b}{t + \left(x + y\right)} \cdot y\\ \mathbf{if}\;t\_1 \leq -4 \cdot 10^{+184}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+270}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
        (t_2 (- (+ a z) (* (/ b (+ t (+ x y))) y))))
   (if (<= t_1 -4e+184) t_2 (if (<= t_1 2e+270) t_1 t_2))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
	double t_2 = (a + z) - ((b / (t + (x + y))) * y);
	double tmp;
	if (t_1 <= -4e+184) {
		tmp = t_2;
	} else if (t_1 <= 2e+270) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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, 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
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
    t_2 = (a + z) - ((b / (t + (x + y))) * y)
    if (t_1 <= (-4d+184)) then
        tmp = t_2
    else if (t_1 <= 2d+270) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
	double t_2 = (a + z) - ((b / (t + (x + y))) * y);
	double tmp;
	if (t_1 <= -4e+184) {
		tmp = t_2;
	} else if (t_1 <= 2e+270) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
	t_2 = (a + z) - ((b / (t + (x + y))) * y)
	tmp = 0
	if t_1 <= -4e+184:
		tmp = t_2
	elif t_1 <= 2e+270:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y))
	t_2 = Float64(Float64(a + z) - Float64(Float64(b / Float64(t + Float64(x + y))) * y))
	tmp = 0.0
	if (t_1 <= -4e+184)
		tmp = t_2;
	elseif (t_1 <= 2e+270)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
	t_2 = (a + z) - ((b / (t + (x + y))) * y);
	tmp = 0.0;
	if (t_1 <= -4e+184)
		tmp = t_2;
	elseif (t_1 <= 2e+270)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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$2 = N[(N[(a + z), $MachinePrecision] - N[(N[(b / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+184], t$95$2, If[LessEqual[t$95$1, 2e+270], t$95$1, t$95$2]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := \left(a + z\right) - \frac{b}{t + \left(x + y\right)} \cdot y\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+184}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+270}:\\
\;\;\;\;t\_1\\

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


\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)) < -4.00000000000000007e184 or 2.0000000000000001e270 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y))

    1. Initial program 61.0%

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \frac{x}{t + \left(x + y\right)} + \frac{y}{t + \left(x + y\right)}, \frac{t + y}{t + \left(x + y\right)} \cdot a\right) - \frac{b \cdot y}{t + \left(x + y\right)} \]
    5. Applied rewrites97.4%

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

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

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

    if -4.00000000000000007e184 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e270

    1. Initial program 61.0%

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

Alternative 5: 78.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\ t_2 := t + \left(x + y\right)\\ t_3 := \left(a + z\right) - \frac{b}{t\_2} \cdot y\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+164}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+192}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, t + y, z \cdot \left(x + y\right)\right)}{t\_2}\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
        (t_2 (+ t (+ x y)))
        (t_3 (- (+ a z) (* (/ b t_2) y))))
   (if (<= t_1 -2e+164)
     t_3
     (if (<= t_1 5e+192) (/ (fma a (+ t y) (* z (+ x y))) t_2) t_3))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
	double t_2 = t + (x + y);
	double t_3 = (a + z) - ((b / t_2) * y);
	double tmp;
	if (t_1 <= -2e+164) {
		tmp = t_3;
	} else if (t_1 <= 5e+192) {
		tmp = fma(a, (t + y), (z * (x + y))) / t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y))
	t_2 = Float64(t + Float64(x + y))
	t_3 = Float64(Float64(a + z) - Float64(Float64(b / t_2) * y))
	tmp = 0.0
	if (t_1 <= -2e+164)
		tmp = t_3;
	elseif (t_1 <= 5e+192)
		tmp = Float64(fma(a, Float64(t + y), Float64(z * Float64(x + y))) / t_2);
	else
		tmp = t_3;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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$2 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a + z), $MachinePrecision] - N[(N[(b / t$95$2), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+164], t$95$3, If[LessEqual[t$95$1, 5e+192], N[(N[(a * N[(t + y), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := t + \left(x + y\right)\\
t_3 := \left(a + z\right) - \frac{b}{t\_2} \cdot y\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+164}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+192}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t + y, z \cdot \left(x + y\right)\right)}{t\_2}\\

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


\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)) < -2e164 or 5.00000000000000033e192 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y))

    1. Initial program 61.0%

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \frac{x}{t + \left(x + y\right)} + \frac{y}{t + \left(x + y\right)}, \frac{t + y}{t + \left(x + y\right)} \cdot a\right) - \frac{b \cdot y}{t + \left(x + y\right)} \]
    5. Applied rewrites97.4%

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

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

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

    if -2e164 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.00000000000000033e192

    1. Initial program 61.0%

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

      \[\leadsto \color{blue}{\frac{a \cdot \left(t + y\right) + z \cdot \left(x + y\right)}{t + \left(x + y\right)}} \]
    3. Applied rewrites47.3%

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

Alternative 6: 71.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\ t_2 := \left(a + z\right) - \frac{b}{t + \left(x + y\right)} \cdot y\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+156}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 10^{-43}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
        (t_2 (- (+ a z) (* (/ b (+ t (+ x y))) y))))
   (if (<= t_1 -5e+156)
     t_2
     (if (<= t_1 1e-43) (/ (fma a t (* x z)) (+ t x)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
	double t_2 = (a + z) - ((b / (t + (x + y))) * y);
	double tmp;
	if (t_1 <= -5e+156) {
		tmp = t_2;
	} else if (t_1 <= 1e-43) {
		tmp = fma(a, t, (x * z)) / (t + x);
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y))
	t_2 = Float64(Float64(a + z) - Float64(Float64(b / Float64(t + Float64(x + y))) * y))
	tmp = 0.0
	if (t_1 <= -5e+156)
		tmp = t_2;
	elseif (t_1 <= 1e-43)
		tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x));
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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$2 = N[(N[(a + z), $MachinePrecision] - N[(N[(b / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+156], t$95$2, If[LessEqual[t$95$1, 1e-43], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := \left(a + z\right) - \frac{b}{t + \left(x + y\right)} \cdot y\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+156}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 10^{-43}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\

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


\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)) < -4.99999999999999992e156 or 1.00000000000000008e-43 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y))

    1. Initial program 61.0%

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \frac{x}{t + \left(x + y\right)} + \frac{y}{t + \left(x + y\right)}, \frac{t + y}{t + \left(x + y\right)} \cdot a\right) - \frac{b \cdot y}{t + \left(x + y\right)} \]
    5. Applied rewrites97.4%

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

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

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

    if -4.99999999999999992e156 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.00000000000000008e-43

    1. Initial program 61.0%

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

      \[\leadsto \color{blue}{\frac{a \cdot t + x \cdot z}{t + x}} \]
    3. Applied rewrites39.6%

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

Alternative 7: 65.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\ t_2 := z - \left(b - a\right)\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+156}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 10^{+221}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
        (t_2 (- z (- b a))))
   (if (<= t_1 -5e+156)
     t_2
     (if (<= t_1 1e+221) (/ (fma a t (* x z)) (+ t x)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
	double t_2 = z - (b - a);
	double tmp;
	if (t_1 <= -5e+156) {
		tmp = t_2;
	} else if (t_1 <= 1e+221) {
		tmp = fma(a, t, (x * z)) / (t + x);
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y))
	t_2 = Float64(z - Float64(b - a))
	tmp = 0.0
	if (t_1 <= -5e+156)
		tmp = t_2;
	elseif (t_1 <= 1e+221)
		tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x));
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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$2 = N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+156], t$95$2, If[LessEqual[t$95$1, 1e+221], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := z - \left(b - a\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+156}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 10^{+221}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\

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


\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)) < -4.99999999999999992e156 or 1e221 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y))

    1. Initial program 61.0%

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

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]
    3. Applied rewrites54.4%

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]
    4. Applied rewrites54.4%

      \[\leadsto \color{blue}{z - \left(b - a\right)} \]

    if -4.99999999999999992e156 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1e221

    1. Initial program 61.0%

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

      \[\leadsto \color{blue}{\frac{a \cdot t + x \cdot z}{t + x}} \]
    3. Applied rewrites39.6%

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

Alternative 8: 56.5% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.75 \cdot 10^{+130}:\\ \;\;\;\;z\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{+114}:\\ \;\;\;\;z - \left(b - a\right)\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= x -1.75e+130) z (if (<= x 1.95e+114) (- z (- b a)) z)))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -1.75e+130) {
		tmp = z;
	} else if (x <= 1.95e+114) {
		tmp = z - (b - a);
	} else {
		tmp = z;
	}
	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, 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
    real(8) :: tmp
    if (x <= (-1.75d+130)) then
        tmp = z
    else if (x <= 1.95d+114) then
        tmp = z - (b - a)
    else
        tmp = z
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -1.75e+130) {
		tmp = z;
	} else if (x <= 1.95e+114) {
		tmp = z - (b - a);
	} else {
		tmp = z;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if x <= -1.75e+130:
		tmp = z
	elif x <= 1.95e+114:
		tmp = z - (b - a)
	else:
		tmp = z
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (x <= -1.75e+130)
		tmp = z;
	elseif (x <= 1.95e+114)
		tmp = Float64(z - Float64(b - a));
	else
		tmp = z;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (x <= -1.75e+130)
		tmp = z;
	elseif (x <= 1.95e+114)
		tmp = z - (b - a);
	else
		tmp = z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.75e+130], z, If[LessEqual[x, 1.95e+114], N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision], z]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+130}:\\
\;\;\;\;z\\

\mathbf{elif}\;x \leq 1.95 \cdot 10^{+114}:\\
\;\;\;\;z - \left(b - a\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.75e130 or 1.95e114 < x

    1. Initial program 61.0%

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

      \[\leadsto \color{blue}{z} \]
    3. Applied rewrites31.2%

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

    if -1.75e130 < x < 1.95e114

    1. Initial program 61.0%

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

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]
    3. Applied rewrites54.4%

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]
    4. Applied rewrites54.4%

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

Alternative 9: 46.3% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{+54}:\\ \;\;\;\;z\\ \mathbf{elif}\;x \leq 1.02 \cdot 10^{-82}:\\ \;\;\;\;a - b\\ \mathbf{elif}\;x \leq 10^{+115}:\\ \;\;\;\;z - b\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= x -2.4e+54)
   z
   (if (<= x 1.02e-82) (- a b) (if (<= x 1e+115) (- z b) z))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -2.4e+54) {
		tmp = z;
	} else if (x <= 1.02e-82) {
		tmp = a - b;
	} else if (x <= 1e+115) {
		tmp = z - b;
	} else {
		tmp = z;
	}
	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, 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
    real(8) :: tmp
    if (x <= (-2.4d+54)) then
        tmp = z
    else if (x <= 1.02d-82) then
        tmp = a - b
    else if (x <= 1d+115) then
        tmp = z - b
    else
        tmp = z
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -2.4e+54) {
		tmp = z;
	} else if (x <= 1.02e-82) {
		tmp = a - b;
	} else if (x <= 1e+115) {
		tmp = z - b;
	} else {
		tmp = z;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if x <= -2.4e+54:
		tmp = z
	elif x <= 1.02e-82:
		tmp = a - b
	elif x <= 1e+115:
		tmp = z - b
	else:
		tmp = z
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (x <= -2.4e+54)
		tmp = z;
	elseif (x <= 1.02e-82)
		tmp = Float64(a - b);
	elseif (x <= 1e+115)
		tmp = Float64(z - b);
	else
		tmp = z;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (x <= -2.4e+54)
		tmp = z;
	elseif (x <= 1.02e-82)
		tmp = a - b;
	elseif (x <= 1e+115)
		tmp = z - b;
	else
		tmp = z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -2.4e+54], z, If[LessEqual[x, 1.02e-82], N[(a - b), $MachinePrecision], If[LessEqual[x, 1e+115], N[(z - b), $MachinePrecision], z]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+54}:\\
\;\;\;\;z\\

\mathbf{elif}\;x \leq 1.02 \cdot 10^{-82}:\\
\;\;\;\;a - b\\

\mathbf{elif}\;x \leq 10^{+115}:\\
\;\;\;\;z - b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.39999999999999998e54 or 1e115 < x

    1. Initial program 61.0%

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

      \[\leadsto \color{blue}{z} \]
    3. Applied rewrites31.2%

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

    if -2.39999999999999998e54 < x < 1.02000000000000007e-82

    1. Initial program 61.0%

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

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]
    3. Applied rewrites54.4%

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]
    4. Taylor expanded in z around 0

      \[\leadsto a - \color{blue}{b} \]
    5. Applied rewrites37.0%

      \[\leadsto a - \color{blue}{b} \]

    if 1.02000000000000007e-82 < x < 1e115

    1. Initial program 61.0%

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

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]
    3. Applied rewrites54.4%

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]
    4. Taylor expanded in a around 0

      \[\leadsto z - \color{blue}{b} \]
    5. Applied rewrites36.1%

      \[\leadsto z - \color{blue}{b} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 10: 45.0% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{+54}:\\ \;\;\;\;z\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-83}:\\ \;\;\;\;a - b\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= x -2.4e+54) z (if (<= x 9.5e-83) (- a b) z)))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -2.4e+54) {
		tmp = z;
	} else if (x <= 9.5e-83) {
		tmp = a - b;
	} else {
		tmp = z;
	}
	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, 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
    real(8) :: tmp
    if (x <= (-2.4d+54)) then
        tmp = z
    else if (x <= 9.5d-83) then
        tmp = a - b
    else
        tmp = z
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -2.4e+54) {
		tmp = z;
	} else if (x <= 9.5e-83) {
		tmp = a - b;
	} else {
		tmp = z;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if x <= -2.4e+54:
		tmp = z
	elif x <= 9.5e-83:
		tmp = a - b
	else:
		tmp = z
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (x <= -2.4e+54)
		tmp = z;
	elseif (x <= 9.5e-83)
		tmp = Float64(a - b);
	else
		tmp = z;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (x <= -2.4e+54)
		tmp = z;
	elseif (x <= 9.5e-83)
		tmp = a - b;
	else
		tmp = z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -2.4e+54], z, If[LessEqual[x, 9.5e-83], N[(a - b), $MachinePrecision], z]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+54}:\\
\;\;\;\;z\\

\mathbf{elif}\;x \leq 9.5 \cdot 10^{-83}:\\
\;\;\;\;a - b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.39999999999999998e54 or 9.50000000000000051e-83 < x

    1. Initial program 61.0%

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

      \[\leadsto \color{blue}{z} \]
    3. Applied rewrites31.2%

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

    if -2.39999999999999998e54 < x < 9.50000000000000051e-83

    1. Initial program 61.0%

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

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]
    3. Applied rewrites54.4%

      \[\leadsto \color{blue}{\left(a + z\right) - b} \]
    4. Taylor expanded in z around 0

      \[\leadsto a - \color{blue}{b} \]
    5. Applied rewrites37.0%

      \[\leadsto a - \color{blue}{b} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 42.4% accurate, 3.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+54}:\\ \;\;\;\;z\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-75}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= x -5e+54) z (if (<= x 2.8e-75) a z)))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -5e+54) {
		tmp = z;
	} else if (x <= 2.8e-75) {
		tmp = a;
	} else {
		tmp = z;
	}
	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, 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
    real(8) :: tmp
    if (x <= (-5d+54)) then
        tmp = z
    else if (x <= 2.8d-75) then
        tmp = a
    else
        tmp = z
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -5e+54) {
		tmp = z;
	} else if (x <= 2.8e-75) {
		tmp = a;
	} else {
		tmp = z;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if x <= -5e+54:
		tmp = z
	elif x <= 2.8e-75:
		tmp = a
	else:
		tmp = z
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (x <= -5e+54)
		tmp = z;
	elseif (x <= 2.8e-75)
		tmp = a;
	else
		tmp = z;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (x <= -5e+54)
		tmp = z;
	elseif (x <= 2.8e-75)
		tmp = a;
	else
		tmp = z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -5e+54], z, If[LessEqual[x, 2.8e-75], a, z]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+54}:\\
\;\;\;\;z\\

\mathbf{elif}\;x \leq 2.8 \cdot 10^{-75}:\\
\;\;\;\;a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.00000000000000005e54 or 2.79999999999999998e-75 < x

    1. Initial program 61.0%

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

      \[\leadsto \color{blue}{z} \]
    3. Applied rewrites31.2%

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

    if -5.00000000000000005e54 < x < 2.79999999999999998e-75

    1. Initial program 61.0%

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

      \[\leadsto \color{blue}{a} \]
    3. Applied rewrites32.4%

      \[\leadsto \color{blue}{a} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 32.4% accurate, 29.5× speedup?

\[\begin{array}{l} \\ a \end{array} \]
(FPCore (x y z t a b) :precision binary64 a)
double code(double x, double y, double z, double t, double a, double b) {
	return a;
}
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 = a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return a;
}
def code(x, y, z, t, a, b):
	return a
function code(x, y, z, t, a, b)
	return a
end
function tmp = code(x, y, z, t, a, b)
	tmp = a;
end
code[x_, y_, z_, t_, a_, b_] := a
\begin{array}{l}

\\
a
\end{array}
Derivation
  1. Initial program 61.0%

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

    \[\leadsto \color{blue}{a} \]
  3. Applied rewrites32.4%

    \[\leadsto \color{blue}{a} \]
  4. Add Preprocessing

Reproduce

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