Statistics.Distribution.Beta:$centropy from math-functions-0.1.5.2

Percentage Accurate: 95.3% → 97.7%
Time: 12.0s
Alternatives: 21
Speedup: 1.1×

Specification

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

\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\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 21 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: 95.3% accurate, 1.0× speedup?

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

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

Alternative 1: 97.7% accurate, 1.1× speedup?

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

\\
\mathsf{fma}\left(y - \left(2 - t\right), b, \mathsf{fma}\left(1 - y, z, \mathsf{fma}\left(1 - t, a, x\right)\right)\right)
\end{array}
Derivation
  1. Initial program 95.3%

    \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
  2. Applied rewrites97.7%

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

Alternative 2: 87.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.000108:\\ \;\;\;\;a + \left(x + \mathsf{fma}\left(b, y - 2, z \cdot \left(1 - y\right)\right)\right)\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+67}:\\ \;\;\;\;x + \left(z + \mathsf{fma}\left(a, 1 - t, b \cdot \left(t - 2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y - \left(2 - t\right), b, \mathsf{fma}\left(1 - y, z, x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= y -0.000108)
   (+ a (+ x (fma b (- y 2.0) (* z (- 1.0 y)))))
   (if (<= y 1.3e+67)
     (+ x (+ z (fma a (- 1.0 t) (* b (- t 2.0)))))
     (fma (- y (- 2.0 t)) b (fma (- 1.0 y) z x)))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -0.000108) {
		tmp = a + (x + fma(b, (y - 2.0), (z * (1.0 - y))));
	} else if (y <= 1.3e+67) {
		tmp = x + (z + fma(a, (1.0 - t), (b * (t - 2.0))));
	} else {
		tmp = fma((y - (2.0 - t)), b, fma((1.0 - y), z, x));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (y <= -0.000108)
		tmp = Float64(a + Float64(x + fma(b, Float64(y - 2.0), Float64(z * Float64(1.0 - y)))));
	elseif (y <= 1.3e+67)
		tmp = Float64(x + Float64(z + fma(a, Float64(1.0 - t), Float64(b * Float64(t - 2.0)))));
	else
		tmp = fma(Float64(y - Float64(2.0 - t)), b, fma(Float64(1.0 - y), z, x));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -0.000108], N[(a + N[(x + N[(b * N[(y - 2.0), $MachinePrecision] + N[(z * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e+67], N[(x + N[(z + N[(a * N[(1.0 - t), $MachinePrecision] + N[(b * N[(t - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - N[(2.0 - t), $MachinePrecision]), $MachinePrecision] * b + N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.000108:\\
\;\;\;\;a + \left(x + \mathsf{fma}\left(b, y - 2, z \cdot \left(1 - y\right)\right)\right)\\

\mathbf{elif}\;y \leq 1.3 \cdot 10^{+67}:\\
\;\;\;\;x + \left(z + \mathsf{fma}\left(a, 1 - t, b \cdot \left(t - 2\right)\right)\right)\\

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


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

    1. Initial program 95.3%

      \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
    2. Applied rewrites97.7%

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

      \[\leadsto \color{blue}{a + \left(x + \left(b \cdot \left(y - 2\right) + z \cdot \left(1 - y\right)\right)\right)} \]
    4. Applied rewrites70.9%

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

    if -1.08e-4 < y < 1.3e67

    1. Initial program 95.3%

      \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
    2. Applied rewrites97.7%

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

      \[\leadsto \color{blue}{x + \left(z + \left(a \cdot \left(1 - t\right) + b \cdot \left(t - 2\right)\right)\right)} \]
    4. Applied rewrites70.4%

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

    if 1.3e67 < y

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

Alternative 3: 87.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -3.4 \cdot 10^{+20}:\\ \;\;\;\;z + \mathsf{fma}\left(a, 1 - t, b \cdot \left(t - 2\right)\right)\\ \mathbf{elif}\;t \leq 6.5 \cdot 10^{+56}:\\ \;\;\;\;a + \left(x + \mathsf{fma}\left(b, y - 2, z \cdot \left(1 - y\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(b - a\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= t -3.4e+20)
   (+ z (fma a (- 1.0 t) (* b (- t 2.0))))
   (if (<= t 6.5e+56)
     (+ a (+ x (fma b (- y 2.0) (* z (- 1.0 y)))))
     (* t (- b a)))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (t <= -3.4e+20) {
		tmp = z + fma(a, (1.0 - t), (b * (t - 2.0)));
	} else if (t <= 6.5e+56) {
		tmp = a + (x + fma(b, (y - 2.0), (z * (1.0 - y))));
	} else {
		tmp = t * (b - a);
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (t <= -3.4e+20)
		tmp = Float64(z + fma(a, Float64(1.0 - t), Float64(b * Float64(t - 2.0))));
	elseif (t <= 6.5e+56)
		tmp = Float64(a + Float64(x + fma(b, Float64(y - 2.0), Float64(z * Float64(1.0 - y)))));
	else
		tmp = Float64(t * Float64(b - a));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.4e+20], N[(z + N[(a * N[(1.0 - t), $MachinePrecision] + N[(b * N[(t - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.5e+56], N[(a + N[(x + N[(b * N[(y - 2.0), $MachinePrecision] + N[(z * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(b - a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{+20}:\\
\;\;\;\;z + \mathsf{fma}\left(a, 1 - t, b \cdot \left(t - 2\right)\right)\\

\mathbf{elif}\;t \leq 6.5 \cdot 10^{+56}:\\
\;\;\;\;a + \left(x + \mathsf{fma}\left(b, y - 2, z \cdot \left(1 - y\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t \cdot \left(b - a\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.4e20

    1. Initial program 95.3%

      \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
    2. Applied rewrites97.7%

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

      \[\leadsto \color{blue}{x + \left(z + \left(a \cdot \left(1 - t\right) + b \cdot \left(t - 2\right)\right)\right)} \]
    4. Applied rewrites70.4%

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

      \[\leadsto z + \color{blue}{\left(a \cdot \left(1 - t\right) + b \cdot \left(t - 2\right)\right)} \]
    6. Applied rewrites56.3%

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

    if -3.4e20 < t < 6.5000000000000001e56

    1. Initial program 95.3%

      \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
    2. Applied rewrites97.7%

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

      \[\leadsto \color{blue}{a + \left(x + \left(b \cdot \left(y - 2\right) + z \cdot \left(1 - y\right)\right)\right)} \]
    4. Applied rewrites70.9%

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

    if 6.5000000000000001e56 < t

    1. Initial program 95.3%

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

      \[\leadsto \color{blue}{t \cdot \left(b - a\right)} \]
    3. Applied rewrites32.3%

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

Alternative 4: 86.5% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x - \mathsf{fma}\left(a, t - 1, z \cdot \left(y - 1\right)\right)\\ \mathbf{if}\;a \leq -1.8 \cdot 10^{+77}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 2.2 \cdot 10^{+107}:\\ \;\;\;\;\mathsf{fma}\left(y - \left(2 - t\right), b, x\right) - \left(z \cdot y - z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (- x (fma a (- t 1.0) (* z (- y 1.0))))))
   (if (<= a -1.8e+77)
     t_1
     (if (<= a 2.2e+107) (- (fma (- y (- 2.0 t)) b x) (- (* z y) z)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x - fma(a, (t - 1.0), (z * (y - 1.0)));
	double tmp;
	if (a <= -1.8e+77) {
		tmp = t_1;
	} else if (a <= 2.2e+107) {
		tmp = fma((y - (2.0 - t)), b, x) - ((z * y) - z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(x - fma(a, Float64(t - 1.0), Float64(z * Float64(y - 1.0))))
	tmp = 0.0
	if (a <= -1.8e+77)
		tmp = t_1;
	elseif (a <= 2.2e+107)
		tmp = Float64(fma(Float64(y - Float64(2.0 - t)), b, x) - Float64(Float64(z * y) - z));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x - N[(a * N[(t - 1.0), $MachinePrecision] + N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.8e+77], t$95$1, If[LessEqual[a, 2.2e+107], N[(N[(N[(y - N[(2.0 - t), $MachinePrecision]), $MachinePrecision] * b + x), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x - \mathsf{fma}\left(a, t - 1, z \cdot \left(y - 1\right)\right)\\
\mathbf{if}\;a \leq -1.8 \cdot 10^{+77}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq 2.2 \cdot 10^{+107}:\\
\;\;\;\;\mathsf{fma}\left(y - \left(2 - t\right), b, x\right) - \left(z \cdot y - z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.7999999999999999e77 or 2.2e107 < a

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto \color{blue}{x - \left(a \cdot \left(t - 1\right) + z \cdot \left(y - 1\right)\right)} \]
    6. Applied rewrites68.2%

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

    if -1.7999999999999999e77 < a < 2.2e107

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites72.9%

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

Alternative 5: 84.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x - \mathsf{fma}\left(a, t - 1, z \cdot \left(y - 1\right)\right)\\ \mathbf{if}\;a \leq -4.8 \cdot 10^{+100}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 2.25 \cdot 10^{+107}:\\ \;\;\;\;\mathsf{fma}\left(y - \left(2 - t\right), b, \mathsf{fma}\left(1 - y, z, x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (- x (fma a (- t 1.0) (* z (- y 1.0))))))
   (if (<= a -4.8e+100)
     t_1
     (if (<= a 2.25e+107) (fma (- y (- 2.0 t)) b (fma (- 1.0 y) z x)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x - fma(a, (t - 1.0), (z * (y - 1.0)));
	double tmp;
	if (a <= -4.8e+100) {
		tmp = t_1;
	} else if (a <= 2.25e+107) {
		tmp = fma((y - (2.0 - t)), b, fma((1.0 - y), z, x));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(x - fma(a, Float64(t - 1.0), Float64(z * Float64(y - 1.0))))
	tmp = 0.0
	if (a <= -4.8e+100)
		tmp = t_1;
	elseif (a <= 2.25e+107)
		tmp = fma(Float64(y - Float64(2.0 - t)), b, fma(Float64(1.0 - y), z, x));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x - N[(a * N[(t - 1.0), $MachinePrecision] + N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -4.8e+100], t$95$1, If[LessEqual[a, 2.25e+107], N[(N[(y - N[(2.0 - t), $MachinePrecision]), $MachinePrecision] * b + N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x - \mathsf{fma}\left(a, t - 1, z \cdot \left(y - 1\right)\right)\\
\mathbf{if}\;a \leq -4.8 \cdot 10^{+100}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq 2.25 \cdot 10^{+107}:\\
\;\;\;\;\mathsf{fma}\left(y - \left(2 - t\right), b, \mathsf{fma}\left(1 - y, z, x\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -4.80000000000000023e100 or 2.25e107 < a

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto \color{blue}{x - \left(a \cdot \left(t - 1\right) + z \cdot \left(y - 1\right)\right)} \]
    6. Applied rewrites68.2%

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

    if -4.80000000000000023e100 < a < 2.25e107

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

Alternative 6: 84.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -3.1 \cdot 10^{-12}:\\ \;\;\;\;\mathsf{fma}\left(y - \left(2 - t\right), b, x + z\right)\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{+115}:\\ \;\;\;\;x - \mathsf{fma}\left(a, t - 1, z \cdot \left(y - 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left(a \cdot t\right) + \left(\left(y + t\right) - 2\right) \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= b -3.1e-12)
   (fma (- y (- 2.0 t)) b (+ x z))
   (if (<= b 1.55e+115)
     (- x (fma a (- t 1.0) (* z (- y 1.0))))
     (+ (* -1.0 (* a t)) (* (- (+ y t) 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (b <= -3.1e-12) {
		tmp = fma((y - (2.0 - t)), b, (x + z));
	} else if (b <= 1.55e+115) {
		tmp = x - fma(a, (t - 1.0), (z * (y - 1.0)));
	} else {
		tmp = (-1.0 * (a * t)) + (((y + t) - 2.0) * b);
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (b <= -3.1e-12)
		tmp = fma(Float64(y - Float64(2.0 - t)), b, Float64(x + z));
	elseif (b <= 1.55e+115)
		tmp = Float64(x - fma(a, Float64(t - 1.0), Float64(z * Float64(y - 1.0))));
	else
		tmp = Float64(Float64(-1.0 * Float64(a * t)) + Float64(Float64(Float64(y + t) - 2.0) * b));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.1e-12], N[(N[(y - N[(2.0 - t), $MachinePrecision]), $MachinePrecision] * b + N[(x + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.55e+115], N[(x - N[(a * N[(t - 1.0), $MachinePrecision] + N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(a * t), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.1 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(y - \left(2 - t\right), b, x + z\right)\\

\mathbf{elif}\;b \leq 1.55 \cdot 10^{+115}:\\
\;\;\;\;x - \mathsf{fma}\left(a, t - 1, z \cdot \left(y - 1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(a \cdot t\right) + \left(\left(y + t\right) - 2\right) \cdot b\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -3.1000000000000001e-12

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto \mathsf{fma}\left(y - \left(2 - t\right), b, x + z\right) \]
    6. Applied rewrites60.1%

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

    if -3.1000000000000001e-12 < b < 1.55000000000000002e115

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto \color{blue}{x - \left(a \cdot \left(t - 1\right) + z \cdot \left(y - 1\right)\right)} \]
    6. Applied rewrites68.2%

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

    if 1.55000000000000002e115 < b

    1. Initial program 95.3%

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

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot t\right)} + \left(\left(y + t\right) - 2\right) \cdot b \]
    3. Applied rewrites50.1%

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

Alternative 7: 83.1% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -3.1 \cdot 10^{-12}:\\ \;\;\;\;\mathsf{fma}\left(y - \left(2 - t\right), b, x + z\right)\\ \mathbf{elif}\;b \leq 4.2 \cdot 10^{+114}:\\ \;\;\;\;x - \mathsf{fma}\left(a, t - 1, z \cdot \left(y - 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + b \cdot \left(\left(t + y\right) - 2\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= b -3.1e-12)
   (fma (- y (- 2.0 t)) b (+ x z))
   (if (<= b 4.2e+114)
     (- x (fma a (- t 1.0) (* z (- y 1.0))))
     (+ x (* b (- (+ t y) 2.0))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (b <= -3.1e-12) {
		tmp = fma((y - (2.0 - t)), b, (x + z));
	} else if (b <= 4.2e+114) {
		tmp = x - fma(a, (t - 1.0), (z * (y - 1.0)));
	} else {
		tmp = x + (b * ((t + y) - 2.0));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (b <= -3.1e-12)
		tmp = fma(Float64(y - Float64(2.0 - t)), b, Float64(x + z));
	elseif (b <= 4.2e+114)
		tmp = Float64(x - fma(a, Float64(t - 1.0), Float64(z * Float64(y - 1.0))));
	else
		tmp = Float64(x + Float64(b * Float64(Float64(t + y) - 2.0)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.1e-12], N[(N[(y - N[(2.0 - t), $MachinePrecision]), $MachinePrecision] * b + N[(x + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.2e+114], N[(x - N[(a * N[(t - 1.0), $MachinePrecision] + N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(b * N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.1 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(y - \left(2 - t\right), b, x + z\right)\\

\mathbf{elif}\;b \leq 4.2 \cdot 10^{+114}:\\
\;\;\;\;x - \mathsf{fma}\left(a, t - 1, z \cdot \left(y - 1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x + b \cdot \left(\left(t + y\right) - 2\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -3.1000000000000001e-12

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto \mathsf{fma}\left(y - \left(2 - t\right), b, x + z\right) \]
    6. Applied rewrites60.1%

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

    if -3.1000000000000001e-12 < b < 4.2000000000000001e114

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto \color{blue}{x - \left(a \cdot \left(t - 1\right) + z \cdot \left(y - 1\right)\right)} \]
    6. Applied rewrites68.2%

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

    if 4.2000000000000001e114 < b

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto x + \color{blue}{\left(z + b \cdot \left(t - 2\right)\right)} \]
    6. Applied rewrites46.1%

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

      \[\leadsto x + \color{blue}{b \cdot \left(\left(t + y\right) - 2\right)} \]
    8. Applied rewrites50.7%

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

Alternative 8: 73.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(y - \left(2 - t\right), b, x + z\right)\\ \mathbf{if}\;b \leq -1.45 \cdot 10^{-14}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq -8.8 \cdot 10^{-65}:\\ \;\;\;\;x - z \cdot \left(y - 1\right)\\ \mathbf{elif}\;b \leq 4.1 \cdot 10^{-16}:\\ \;\;\;\;x + \left(z + a \cdot \left(1 - t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (fma (- y (- 2.0 t)) b (+ x z))))
   (if (<= b -1.45e-14)
     t_1
     (if (<= b -8.8e-65)
       (- x (* z (- y 1.0)))
       (if (<= b 4.1e-16) (+ x (+ z (* a (- 1.0 t)))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fma((y - (2.0 - t)), b, (x + z));
	double tmp;
	if (b <= -1.45e-14) {
		tmp = t_1;
	} else if (b <= -8.8e-65) {
		tmp = x - (z * (y - 1.0));
	} else if (b <= 4.1e-16) {
		tmp = x + (z + (a * (1.0 - t)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = fma(Float64(y - Float64(2.0 - t)), b, Float64(x + z))
	tmp = 0.0
	if (b <= -1.45e-14)
		tmp = t_1;
	elseif (b <= -8.8e-65)
		tmp = Float64(x - Float64(z * Float64(y - 1.0)));
	elseif (b <= 4.1e-16)
		tmp = Float64(x + Float64(z + Float64(a * Float64(1.0 - t))));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y - N[(2.0 - t), $MachinePrecision]), $MachinePrecision] * b + N[(x + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.45e-14], t$95$1, If[LessEqual[b, -8.8e-65], N[(x - N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.1e-16], N[(x + N[(z + N[(a * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - \left(2 - t\right), b, x + z\right)\\
\mathbf{if}\;b \leq -1.45 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq -8.8 \cdot 10^{-65}:\\
\;\;\;\;x - z \cdot \left(y - 1\right)\\

\mathbf{elif}\;b \leq 4.1 \cdot 10^{-16}:\\
\;\;\;\;x + \left(z + a \cdot \left(1 - t\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -1.4500000000000001e-14 or 4.10000000000000006e-16 < b

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto \mathsf{fma}\left(y - \left(2 - t\right), b, x + z\right) \]
    6. Applied rewrites60.1%

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

    if -1.4500000000000001e-14 < b < -8.80000000000000084e-65

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Taylor expanded in t around 0

      \[\leadsto \left(x + b \cdot \left(y - 2\right)\right) - \color{blue}{z} \cdot \left(y - 1\right) \]
    5. Applied rewrites60.3%

      \[\leadsto \left(x + b \cdot \left(y - 2\right)\right) - \color{blue}{z} \cdot \left(y - 1\right) \]
    6. Taylor expanded in b around 0

      \[\leadsto x - \color{blue}{z \cdot \left(y - 1\right)} \]
    7. Applied rewrites42.0%

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

    if -8.80000000000000084e-65 < b < 4.10000000000000006e-16

    1. Initial program 95.3%

      \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
    2. Applied rewrites97.7%

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

      \[\leadsto \color{blue}{x + \left(z + \left(a \cdot \left(1 - t\right) + b \cdot \left(t - 2\right)\right)\right)} \]
    4. Applied rewrites70.4%

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

      \[\leadsto x + \left(z + \color{blue}{a \cdot \left(1 - t\right)}\right) \]
    6. Applied rewrites52.3%

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

Alternative 9: 71.2% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + b \cdot \left(\left(t + y\right) - 2\right)\\ \mathbf{if}\;b \leq -5.1 \cdot 10^{-14}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq -8.8 \cdot 10^{-65}:\\ \;\;\;\;x - z \cdot \left(y - 1\right)\\ \mathbf{elif}\;b \leq 2.7 \cdot 10^{+55}:\\ \;\;\;\;x + \left(z + a \cdot \left(1 - t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ x (* b (- (+ t y) 2.0)))))
   (if (<= b -5.1e-14)
     t_1
     (if (<= b -8.8e-65)
       (- x (* z (- y 1.0)))
       (if (<= b 2.7e+55) (+ x (+ z (* a (- 1.0 t)))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (b * ((t + y) - 2.0));
	double tmp;
	if (b <= -5.1e-14) {
		tmp = t_1;
	} else if (b <= -8.8e-65) {
		tmp = x - (z * (y - 1.0));
	} else if (b <= 2.7e+55) {
		tmp = x + (z + (a * (1.0 - t)));
	} else {
		tmp = t_1;
	}
	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) :: tmp
    t_1 = x + (b * ((t + y) - 2.0d0))
    if (b <= (-5.1d-14)) then
        tmp = t_1
    else if (b <= (-8.8d-65)) then
        tmp = x - (z * (y - 1.0d0))
    else if (b <= 2.7d+55) then
        tmp = x + (z + (a * (1.0d0 - t)))
    else
        tmp = t_1
    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 + (b * ((t + y) - 2.0));
	double tmp;
	if (b <= -5.1e-14) {
		tmp = t_1;
	} else if (b <= -8.8e-65) {
		tmp = x - (z * (y - 1.0));
	} else if (b <= 2.7e+55) {
		tmp = x + (z + (a * (1.0 - t)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x + (b * ((t + y) - 2.0))
	tmp = 0
	if b <= -5.1e-14:
		tmp = t_1
	elif b <= -8.8e-65:
		tmp = x - (z * (y - 1.0))
	elif b <= 2.7e+55:
		tmp = x + (z + (a * (1.0 - t)))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(b * Float64(Float64(t + y) - 2.0)))
	tmp = 0.0
	if (b <= -5.1e-14)
		tmp = t_1;
	elseif (b <= -8.8e-65)
		tmp = Float64(x - Float64(z * Float64(y - 1.0)));
	elseif (b <= 2.7e+55)
		tmp = Float64(x + Float64(z + Float64(a * Float64(1.0 - t))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x + (b * ((t + y) - 2.0));
	tmp = 0.0;
	if (b <= -5.1e-14)
		tmp = t_1;
	elseif (b <= -8.8e-65)
		tmp = x - (z * (y - 1.0));
	elseif (b <= 2.7e+55)
		tmp = x + (z + (a * (1.0 - t)));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(b * N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -5.1e-14], t$95$1, If[LessEqual[b, -8.8e-65], N[(x - N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.7e+55], N[(x + N[(z + N[(a * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + b \cdot \left(\left(t + y\right) - 2\right)\\
\mathbf{if}\;b \leq -5.1 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq -8.8 \cdot 10^{-65}:\\
\;\;\;\;x - z \cdot \left(y - 1\right)\\

\mathbf{elif}\;b \leq 2.7 \cdot 10^{+55}:\\
\;\;\;\;x + \left(z + a \cdot \left(1 - t\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -5.0999999999999997e-14 or 2.69999999999999977e55 < b

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto x + \color{blue}{\left(z + b \cdot \left(t - 2\right)\right)} \]
    6. Applied rewrites46.1%

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

      \[\leadsto x + \color{blue}{b \cdot \left(\left(t + y\right) - 2\right)} \]
    8. Applied rewrites50.7%

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

    if -5.0999999999999997e-14 < b < -8.80000000000000084e-65

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Taylor expanded in t around 0

      \[\leadsto \left(x + b \cdot \left(y - 2\right)\right) - \color{blue}{z} \cdot \left(y - 1\right) \]
    5. Applied rewrites60.3%

      \[\leadsto \left(x + b \cdot \left(y - 2\right)\right) - \color{blue}{z} \cdot \left(y - 1\right) \]
    6. Taylor expanded in b around 0

      \[\leadsto x - \color{blue}{z \cdot \left(y - 1\right)} \]
    7. Applied rewrites42.0%

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

    if -8.80000000000000084e-65 < b < 2.69999999999999977e55

    1. Initial program 95.3%

      \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
    2. Applied rewrites97.7%

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

      \[\leadsto \color{blue}{x + \left(z + \left(a \cdot \left(1 - t\right) + b \cdot \left(t - 2\right)\right)\right)} \]
    4. Applied rewrites70.4%

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

      \[\leadsto x + \left(z + \color{blue}{a \cdot \left(1 - t\right)}\right) \]
    6. Applied rewrites52.3%

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

Alternative 10: 69.9% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
t_1 := b \cdot \left(\left(t + y\right) - 2\right)\\
\mathbf{if}\;b \leq -2.3 \cdot 10^{+100}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq 3.6 \cdot 10^{+55}:\\
\;\;\;\;x + \left(z + a \cdot \left(1 - t\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -2.2999999999999999e100 or 3.59999999999999987e55 < b

    1. Initial program 95.3%

      \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
    2. Applied rewrites97.7%

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

      \[\leadsto \color{blue}{x + \left(z + \left(a \cdot \left(1 - t\right) + b \cdot \left(t - 2\right)\right)\right)} \]
    4. Applied rewrites70.4%

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

      \[\leadsto \color{blue}{b \cdot \left(\left(t + y\right) - 2\right)} \]
    6. Applied rewrites36.9%

      \[\leadsto \color{blue}{b \cdot \left(\left(t + y\right) - 2\right)} \]

    if -2.2999999999999999e100 < b < 3.59999999999999987e55

    1. Initial program 95.3%

      \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
    2. Applied rewrites97.7%

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

      \[\leadsto \color{blue}{x + \left(z + \left(a \cdot \left(1 - t\right) + b \cdot \left(t - 2\right)\right)\right)} \]
    4. Applied rewrites70.4%

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

      \[\leadsto x + \left(z + \color{blue}{a \cdot \left(1 - t\right)}\right) \]
    6. Applied rewrites52.3%

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

Alternative 11: 61.2% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_1 := b \cdot \left(\left(t + y\right) - 2\right)\\
\mathbf{if}\;b \leq -2.3 \cdot 10^{+62}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq 8 \cdot 10^{-10}:\\
\;\;\;\;x - z \cdot \left(y - 1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -2.29999999999999984e62 or 8.00000000000000029e-10 < b

    1. Initial program 95.3%

      \[\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
    2. Applied rewrites97.7%

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

      \[\leadsto \color{blue}{x + \left(z + \left(a \cdot \left(1 - t\right) + b \cdot \left(t - 2\right)\right)\right)} \]
    4. Applied rewrites70.4%

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

      \[\leadsto \color{blue}{b \cdot \left(\left(t + y\right) - 2\right)} \]
    6. Applied rewrites36.9%

      \[\leadsto \color{blue}{b \cdot \left(\left(t + y\right) - 2\right)} \]

    if -2.29999999999999984e62 < b < 8.00000000000000029e-10

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Taylor expanded in t around 0

      \[\leadsto \left(x + b \cdot \left(y - 2\right)\right) - \color{blue}{z} \cdot \left(y - 1\right) \]
    5. Applied rewrites60.3%

      \[\leadsto \left(x + b \cdot \left(y - 2\right)\right) - \color{blue}{z} \cdot \left(y - 1\right) \]
    6. Taylor expanded in b around 0

      \[\leadsto x - \color{blue}{z \cdot \left(y - 1\right)} \]
    7. Applied rewrites42.0%

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

Alternative 12: 57.8% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_1 := t \cdot \left(b - a\right)\\
\mathbf{if}\;t \leq -760000000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 3.2 \cdot 10^{+50}:\\
\;\;\;\;x - z \cdot \left(y - 1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7.6e11 or 3.19999999999999983e50 < t

    1. Initial program 95.3%

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

      \[\leadsto \color{blue}{t \cdot \left(b - a\right)} \]
    3. Applied rewrites32.3%

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

    if -7.6e11 < t < 3.19999999999999983e50

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Taylor expanded in t around 0

      \[\leadsto \left(x + b \cdot \left(y - 2\right)\right) - \color{blue}{z} \cdot \left(y - 1\right) \]
    5. Applied rewrites60.3%

      \[\leadsto \left(x + b \cdot \left(y - 2\right)\right) - \color{blue}{z} \cdot \left(y - 1\right) \]
    6. Taylor expanded in b around 0

      \[\leadsto x - \color{blue}{z \cdot \left(y - 1\right)} \]
    7. Applied rewrites42.0%

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

Alternative 13: 50.2% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;y \leq -1.1 \cdot 10^{-47}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -2.45 \cdot 10^{-284}:\\
\;\;\;\;x + z\\

\mathbf{elif}\;y \leq 3.3 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.3e15 or 3.2999999999999998e46 < y

    1. Initial program 95.3%

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

      \[\leadsto \color{blue}{y \cdot \left(b - z\right)} \]
    3. Applied rewrites32.6%

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

    if -1.3e15 < y < -1.10000000000000009e-47 or -2.44999999999999995e-284 < y < 3.2999999999999998e46

    1. Initial program 95.3%

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

      \[\leadsto \color{blue}{t \cdot \left(b - a\right)} \]
    3. Applied rewrites32.3%

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

    if -1.10000000000000009e-47 < y < -2.44999999999999995e-284

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto x + \color{blue}{\left(z + b \cdot \left(t - 2\right)\right)} \]
    6. Applied rewrites46.1%

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

      \[\leadsto x + z \]
    8. Applied rewrites25.0%

      \[\leadsto x + z \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 14: 44.5% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
t_1 := t \cdot \left(b - a\right)\\
\mathbf{if}\;t \leq -1.25 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq -1.8 \cdot 10^{-39}:\\
\;\;\;\;x + z\\

\mathbf{elif}\;t \leq -1.9 \cdot 10^{-294}:\\
\;\;\;\;z \cdot \left(-y\right)\\

\mathbf{elif}\;t \leq 7.8 \cdot 10^{+49}:\\
\;\;\;\;x + z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.25e14 or 7.8000000000000002e49 < t

    1. Initial program 95.3%

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

      \[\leadsto \color{blue}{t \cdot \left(b - a\right)} \]
    3. Applied rewrites32.3%

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

    if -1.25e14 < t < -1.8e-39 or -1.9e-294 < t < 7.8000000000000002e49

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto x + \color{blue}{\left(z + b \cdot \left(t - 2\right)\right)} \]
    6. Applied rewrites46.1%

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

      \[\leadsto x + z \]
    8. Applied rewrites25.0%

      \[\leadsto x + z \]

    if -1.8e-39 < t < -1.9e-294

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{z \cdot \left(1 - y\right)} \]
    4. Taylor expanded in y around inf

      \[\leadsto z \cdot \left(-1 \cdot \color{blue}{y}\right) \]
    5. Applied rewrites19.0%

      \[\leadsto z \cdot \left(-1 \cdot \color{blue}{y}\right) \]
    6. Applied rewrites19.0%

      \[\leadsto z \cdot \left(-y\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 15: 40.0% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_1 := a \cdot \left(1 - t\right)\\
\mathbf{if}\;a \leq -3.5 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq -2.55 \cdot 10^{-202}:\\
\;\;\;\;b \cdot t\\

\mathbf{elif}\;a \leq 1.18 \cdot 10^{+32}:\\
\;\;\;\;x + z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -3.49999999999999987e69 or 1.1800000000000001e32 < a

    1. Initial program 95.3%

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

      \[\leadsto \color{blue}{a \cdot \left(1 - t\right)} \]
    3. Applied rewrites29.1%

      \[\leadsto \color{blue}{a \cdot \left(1 - t\right)} \]

    if -3.49999999999999987e69 < a < -2.54999999999999998e-202

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto b \cdot \color{blue}{t} \]
    6. Applied rewrites16.7%

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

    if -2.54999999999999998e-202 < a < 1.1800000000000001e32

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto x + \color{blue}{\left(z + b \cdot \left(t - 2\right)\right)} \]
    6. Applied rewrites46.1%

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

      \[\leadsto x + z \]
    8. Applied rewrites25.0%

      \[\leadsto x + z \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 16: 36.7% accurate, 2.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+24}:\\
\;\;\;\;y \cdot b\\

\mathbf{elif}\;y \leq 7.2 \cdot 10^{+46}:\\
\;\;\;\;x + z\\

\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.40000000000000003e24

    1. Initial program 95.3%

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

      \[\leadsto \color{blue}{y \cdot \left(b - z\right)} \]
    3. Applied rewrites32.6%

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

      \[\leadsto y \cdot b \]
    5. Applied rewrites17.9%

      \[\leadsto y \cdot b \]

    if -4.40000000000000003e24 < y < 7.1999999999999997e46

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto x + \color{blue}{\left(z + b \cdot \left(t - 2\right)\right)} \]
    6. Applied rewrites46.1%

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

      \[\leadsto x + z \]
    8. Applied rewrites25.0%

      \[\leadsto x + z \]

    if 7.1999999999999997e46 < y

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{z \cdot \left(1 - y\right)} \]
    4. Taylor expanded in y around inf

      \[\leadsto z \cdot \left(-1 \cdot \color{blue}{y}\right) \]
    5. Applied rewrites19.0%

      \[\leadsto z \cdot \left(-1 \cdot \color{blue}{y}\right) \]
    6. Applied rewrites19.0%

      \[\leadsto z \cdot \left(-y\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 17: 33.1% accurate, 2.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{+62}:\\
\;\;\;\;b \cdot t\\

\mathbf{elif}\;b \leq 2.8 \cdot 10^{+83}:\\
\;\;\;\;x + z\\

\mathbf{else}:\\
\;\;\;\;y \cdot b\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -2.29999999999999984e62

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto b \cdot \color{blue}{t} \]
    6. Applied rewrites16.7%

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

    if -2.29999999999999984e62 < b < 2.8e83

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto x + \color{blue}{\left(z + b \cdot \left(t - 2\right)\right)} \]
    6. Applied rewrites46.1%

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

      \[\leadsto x + z \]
    8. Applied rewrites25.0%

      \[\leadsto x + z \]

    if 2.8e83 < b

    1. Initial program 95.3%

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

      \[\leadsto \color{blue}{y \cdot \left(b - z\right)} \]
    3. Applied rewrites32.6%

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

      \[\leadsto y \cdot b \]
    5. Applied rewrites17.9%

      \[\leadsto y \cdot b \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 18: 32.7% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.3 \cdot 10^{+62}:\\ \;\;\;\;b \cdot t\\ \mathbf{elif}\;b \leq 1.06 \cdot 10^{+49}:\\ \;\;\;\;x + z\\ \mathbf{else}:\\ \;\;\;\;b \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= b -2.3e+62) (* b t) (if (<= b 1.06e+49) (+ x z) (* b t))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (b <= -2.3e+62) {
		tmp = b * t;
	} else if (b <= 1.06e+49) {
		tmp = x + z;
	} else {
		tmp = b * t;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, 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 (b <= (-2.3d+62)) then
        tmp = b * t
    else if (b <= 1.06d+49) then
        tmp = x + z
    else
        tmp = b * t
    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 (b <= -2.3e+62) {
		tmp = b * t;
	} else if (b <= 1.06e+49) {
		tmp = x + z;
	} else {
		tmp = b * t;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if b <= -2.3e+62:
		tmp = b * t
	elif b <= 1.06e+49:
		tmp = x + z
	else:
		tmp = b * t
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (b <= -2.3e+62)
		tmp = Float64(b * t);
	elseif (b <= 1.06e+49)
		tmp = Float64(x + z);
	else
		tmp = Float64(b * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (b <= -2.3e+62)
		tmp = b * t;
	elseif (b <= 1.06e+49)
		tmp = x + z;
	else
		tmp = b * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -2.3e+62], N[(b * t), $MachinePrecision], If[LessEqual[b, 1.06e+49], N[(x + z), $MachinePrecision], N[(b * t), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{+62}:\\
\;\;\;\;b \cdot t\\

\mathbf{elif}\;b \leq 1.06 \cdot 10^{+49}:\\
\;\;\;\;x + z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -2.29999999999999984e62 or 1.06e49 < b

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto b \cdot \color{blue}{t} \]
    6. Applied rewrites16.7%

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

    if -2.29999999999999984e62 < b < 1.06e49

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto x + \color{blue}{\left(z + b \cdot \left(t - 2\right)\right)} \]
    6. Applied rewrites46.1%

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

      \[\leadsto x + z \]
    8. Applied rewrites25.0%

      \[\leadsto x + z \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 19: 28.6% accurate, 2.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.7 \cdot 10^{+263}:\\
\;\;\;\;a\\

\mathbf{elif}\;a \leq 1.1 \cdot 10^{+161}:\\
\;\;\;\;x + z\\

\mathbf{else}:\\
\;\;\;\;a\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -4.69999999999999973e263 or 1.1e161 < a

    1. Initial program 95.3%

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

      \[\leadsto \color{blue}{a \cdot \left(1 - t\right)} \]
    3. Applied rewrites29.1%

      \[\leadsto \color{blue}{a \cdot \left(1 - t\right)} \]
    4. Taylor expanded in t around 0

      \[\leadsto a \]
    5. Applied rewrites11.5%

      \[\leadsto a \]

    if -4.69999999999999973e263 < a < 1.1e161

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{\left(x + b \cdot \left(\left(t + y\right) - 2\right)\right) - z \cdot \left(y - 1\right)} \]
    4. Applied rewrites73.9%

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

      \[\leadsto x + \color{blue}{\left(z + b \cdot \left(t - 2\right)\right)} \]
    6. Applied rewrites46.1%

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

      \[\leadsto x + z \]
    8. Applied rewrites25.0%

      \[\leadsto x + z \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 20: 17.6% accurate, 3.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{+56}:\\
\;\;\;\;a\\

\mathbf{elif}\;a \leq 35000000:\\
\;\;\;\;z\\

\mathbf{else}:\\
\;\;\;\;a\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.10000000000000005e56 or 3.5e7 < a

    1. Initial program 95.3%

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

      \[\leadsto \color{blue}{a \cdot \left(1 - t\right)} \]
    3. Applied rewrites29.1%

      \[\leadsto \color{blue}{a \cdot \left(1 - t\right)} \]
    4. Taylor expanded in t around 0

      \[\leadsto a \]
    5. Applied rewrites11.5%

      \[\leadsto a \]

    if -3.10000000000000005e56 < a < 3.5e7

    1. Initial program 95.3%

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

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

      \[\leadsto \color{blue}{z \cdot \left(1 - y\right)} \]
    4. Taylor expanded in y around 0

      \[\leadsto z \]
    5. Applied rewrites11.3%

      \[\leadsto z \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 21: 11.5% accurate, 28.4× 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 95.3%

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

    \[\leadsto \color{blue}{a \cdot \left(1 - t\right)} \]
  3. Applied rewrites29.1%

    \[\leadsto \color{blue}{a \cdot \left(1 - t\right)} \]
  4. Taylor expanded in t around 0

    \[\leadsto a \]
  5. Applied rewrites11.5%

    \[\leadsto a \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2025153 
(FPCore (x y z t a b)
  :name "Statistics.Distribution.Beta:$centropy from math-functions-0.1.5.2"
  :precision binary64
  (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))