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

Percentage Accurate: 95.3% → 98.3%
Time: 5.4s
Alternatives: 23
Speedup: 0.5×

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 23 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: 98.3% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b)) < +inf.0

    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(\left(x + a \cdot \left(1 - t\right)\right) - z \cdot \left(y - 1\right)\right)} + \left(\left(y + t\right) - 2\right) \cdot b \]
    3. Step-by-step derivation
      1. lower--.f64N/A

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(1 - t, a, x\right) - \left(y - 1\right) \cdot z\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
      8. lift-*.f6495.3

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

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

    if +inf.0 < (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) 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}{t \cdot \left(b - a\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(b - a\right) \cdot \color{blue}{t} \]
      3. lower--.f6432.6

        \[\leadsto \left(b - a\right) \cdot t \]
    4. Applied rewrites32.6%

      \[\leadsto \color{blue}{\left(b - a\right) \cdot t} \]
    5. Taylor expanded in a around inf

      \[\leadsto \left(a \cdot \left(\frac{b}{a} - 1\right)\right) \cdot t \]
    6. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(\left(\frac{b}{a} - 1\right) \cdot a\right) \cdot t \]
      4. lower-/.f6432.9

        \[\leadsto \left(\left(\frac{b}{a} - 1\right) \cdot a\right) \cdot t \]
    7. Applied rewrites32.9%

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

Alternative 2: 92.4% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -130000000:\\
\;\;\;\;\left(\left(x - \left(\frac{-z}{y} + z\right) \cdot y\right) - \left(t - 1\right) \cdot a\right) + b \cdot y\\

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

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


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

    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 \left(\left(x - \color{blue}{y \cdot \left(z + -1 \cdot \frac{z}{y}\right)}\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

        \[\leadsto \left(\left(x - \left(\frac{\mathsf{neg}\left(z\right)}{y} + z\right) \cdot y\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
      8. lower-neg.f6485.0

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

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

      \[\leadsto \left(\left(x - \left(\frac{-z}{y} + z\right) \cdot y\right) - \left(t - 1\right) \cdot a\right) + \color{blue}{b \cdot y} \]
    6. Step-by-step derivation
      1. lower-*.f6470.3

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

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

    if -1.3e8 < y < 1.69999999999999996

    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 0

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \mathsf{fma}\left(t - 1, \color{blue}{a}, -1 \cdot z\right) \]
      9. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right) \]
      10. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right) \]
      11. lower-neg.f6468.8

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \mathsf{fma}\left(t - 1, a, -z\right) \]
    4. Applied rewrites68.8%

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

    if 1.69999999999999996 < 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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

      \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - a \cdot \color{blue}{t}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6477.5

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - a \cdot t\right) + \color{blue}{x} \]
      3. lower-+.f6477.5

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

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

Alternative 3: 90.3% accurate, 0.9× speedup?

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

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

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

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


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

    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. Step-by-step derivation
      1. lower--.f64N/A

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

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

        \[\leadsto \left(b \cdot \left(\left(y + t\right) - 2\right) + x\right) - z \cdot \left(y - 1\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\left(y + t\right) - 2\right) \cdot b + x\right) - z \cdot \left(y - 1\right) \]
      5. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - z \cdot \left(y - 1\right) \]
      8. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - z \cdot \left(y - 1\right) \]
      9. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(y - 1\right) \cdot z \]
      11. lift-*.f6474.4

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

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

    if -7.7999999999999997e-8 < y < 1.69999999999999996

    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 0

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \mathsf{fma}\left(t - 1, \color{blue}{a}, -1 \cdot z\right) \]
      9. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right) \]
      10. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right) \]
      11. lower-neg.f6468.8

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \mathsf{fma}\left(t - 1, a, -z\right) \]
    4. Applied rewrites68.8%

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

    if 1.69999999999999996 < 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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

      \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - a \cdot \color{blue}{t}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6477.5

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - a \cdot t\right) + \color{blue}{x} \]
      3. lower-+.f6477.5

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

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

Alternative 4: 87.8% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.7999999999999997e-8 or 0.0389999999999999999 < 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. Step-by-step derivation
      1. lower--.f64N/A

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

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

        \[\leadsto \left(b \cdot \left(\left(y + t\right) - 2\right) + x\right) - z \cdot \left(y - 1\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\left(y + t\right) - 2\right) \cdot b + x\right) - z \cdot \left(y - 1\right) \]
      5. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - z \cdot \left(y - 1\right) \]
      8. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - z \cdot \left(y - 1\right) \]
      9. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(y - 1\right) \cdot z \]
      11. lift-*.f6474.4

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

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

    if -7.7999999999999997e-8 < y < 0.0389999999999999999

    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 0

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \mathsf{fma}\left(t - 1, \color{blue}{a}, -1 \cdot z\right) \]
      9. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right) \]
      10. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right) \]
      11. lower-neg.f6468.8

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \mathsf{fma}\left(t - 1, a, -z\right) \]
    4. Applied rewrites68.8%

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

Alternative 5: 86.4% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;z \leq 1.25 \cdot 10^{+44}:\\
\;\;\;\;t\_1 - \left(t - 1\right) \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4e17 or 1.2499999999999999e44 < z

    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. Step-by-step derivation
      1. lower--.f64N/A

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

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

        \[\leadsto \left(b \cdot \left(\left(y + t\right) - 2\right) + x\right) - z \cdot \left(y - 1\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\left(y + t\right) - 2\right) \cdot b + x\right) - z \cdot \left(y - 1\right) \]
      5. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - z \cdot \left(y - 1\right) \]
      8. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - z \cdot \left(y - 1\right) \]
      9. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(y - 1\right) \cdot z \]
      11. lift-*.f6474.4

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

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

    if -4e17 < z < 1.2499999999999999e44

    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 0

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

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

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

        \[\leadsto \left(b \cdot \left(\left(y + t\right) - 2\right) + x\right) - a \cdot \left(t - 1\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\left(y + t\right) - 2\right) \cdot b + x\right) - a \cdot \left(t - 1\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - \color{blue}{a} \cdot \left(t - 1\right) \]
      6. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      8. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot \color{blue}{a} \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot a \]
      11. lift-*.f6472.8

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

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

Alternative 6: 86.3% accurate, 1.0× 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}\;z \leq -4.8 \cdot 10^{+17}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+92}:\\ \;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot a\\ \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 (<= z -4.8e+17)
     t_1
     (if (<= z 1.8e+92) (- (fma (- (+ t y) 2.0) b x) (* (- t 1.0) a)) 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 (z <= -4.8e+17) {
		tmp = t_1;
	} else if (z <= 1.8e+92) {
		tmp = fma(((t + y) - 2.0), b, x) - ((t - 1.0) * a);
	} 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 (z <= -4.8e+17)
		tmp = t_1;
	elseif (z <= 1.8e+92)
		tmp = Float64(fma(Float64(Float64(t + y) - 2.0), b, x) - Float64(Float64(t - 1.0) * a));
	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[z, -4.8e+17], t$95$1, If[LessEqual[z, 1.8e+92], N[(N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $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}\;z \leq -4.8 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.8e17 or 1.8e92 < z

    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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

      \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - a \cdot \color{blue}{t}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6477.5

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

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

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

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

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

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

        \[\leadsto x - \mathsf{fma}\left(a, t - 1, z \cdot \left(y - 1\right)\right) \]
      5. lower--.f6467.7

        \[\leadsto x - \mathsf{fma}\left(a, t - 1, z \cdot \left(y - 1\right)\right) \]
    10. Applied rewrites67.7%

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

    if -4.8e17 < z < 1.8e92

    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 0

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

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

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

        \[\leadsto \left(b \cdot \left(\left(y + t\right) - 2\right) + x\right) - a \cdot \left(t - 1\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\left(y + t\right) - 2\right) \cdot b + x\right) - a \cdot \left(t - 1\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - \color{blue}{a} \cdot \left(t - 1\right) \]
      6. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      8. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot \color{blue}{a} \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot a \]
      11. lift-*.f6472.8

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

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

Alternative 7: 83.5% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.5 \cdot 10^{+80}:\\
\;\;\;\;\left(-a\right) \cdot t + \left(\left(y + t\right) - 2\right) \cdot b\\

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

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


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

    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. Step-by-step derivation
      1. associate-*r*N/A

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

        \[\leadsto \left(-1 \cdot a\right) \cdot \color{blue}{t} + \left(\left(y + t\right) - 2\right) \cdot b \]
      3. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(a\right)\right) \cdot t + \left(\left(y + t\right) - 2\right) \cdot b \]
      4. lower-neg.f6449.8

        \[\leadsto \left(-a\right) \cdot t + \left(\left(y + t\right) - 2\right) \cdot b \]
    4. Applied rewrites49.8%

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

    if -8.50000000000000007e80 < b < 2.6500000000000001e95

    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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

      \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - a \cdot \color{blue}{t}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6477.5

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

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

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

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

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

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

        \[\leadsto x - \mathsf{fma}\left(a, t - 1, z \cdot \left(y - 1\right)\right) \]
      5. lower--.f6467.7

        \[\leadsto x - \mathsf{fma}\left(a, t - 1, z \cdot \left(y - 1\right)\right) \]
    10. Applied rewrites67.7%

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

    if 2.6500000000000001e95 < 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 z around 0

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

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

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

        \[\leadsto \left(b \cdot \left(\left(y + t\right) - 2\right) + x\right) - a \cdot \left(t - 1\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\left(y + t\right) - 2\right) \cdot b + x\right) - a \cdot \left(t - 1\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - \color{blue}{a} \cdot \left(t - 1\right) \]
      6. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      8. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot \color{blue}{a} \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot a \]
      11. lift-*.f6472.8

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

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

      \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - -1 \cdot \color{blue}{a} \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(\mathsf{neg}\left(a\right)\right) \]
      2. lower-neg.f6460.3

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

      \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(-a\right) \]
    8. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \color{blue}{\left(-a\right)} \]
      2. lift-fma.f64N/A

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

        \[\leadsto \left(\left(\left(t + y\right) - 2\right) \cdot b + x\right) - \left(-a\right) \]
      4. lift--.f64N/A

        \[\leadsto \left(\left(\left(t + y\right) - 2\right) \cdot b + x\right) - \left(-a\right) \]
      5. associate--l+N/A

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

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, \color{blue}{b}, x - \left(-a\right)\right) \]
      7. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x - \left(-a\right)\right) \]
      8. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x - \left(-a\right)\right) \]
      9. lower--.f6460.3

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

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

Alternative 8: 71.6% accurate, 1.2× speedup?

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

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

\mathbf{elif}\;y \leq 44000:\\
\;\;\;\;x + \left(b \cdot t - \left(t - 1\right) \cdot a\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.55e28 or 44000 < 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}{-1 \cdot \left(y \cdot z\right)} + \left(\left(y + t\right) - 2\right) \cdot b \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(y \cdot z\right)\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
      2. lower-neg.f64N/A

        \[\leadsto \left(-y \cdot z\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
      3. *-commutativeN/A

        \[\leadsto \left(-z \cdot y\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
      4. lower-*.f6450.8

        \[\leadsto \left(-z \cdot y\right) + \left(\left(y + t\right) - 2\right) \cdot b \]
    4. Applied rewrites50.8%

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

    if -1.55e28 < y < 44000

    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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

      \[\leadsto x + \left(b \cdot t - \mathsf{fma}\left(\color{blue}{t - 1}, a, -z\right)\right) \]
    6. Step-by-step derivation
      1. lower-*.f6462.4

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

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

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

        \[\leadsto x + \left(b \cdot t - \left(t - 1\right) \cdot a\right) \]
      2. lift--.f64N/A

        \[\leadsto x + \left(b \cdot t - \left(t - 1\right) \cdot a\right) \]
      3. lift-*.f6453.0

        \[\leadsto x + \left(b \cdot t - \left(t - 1\right) \cdot a\right) \]
    10. Applied rewrites53.0%

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

Alternative 9: 71.6% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;b \leq 1.2 \cdot 10^{+36}:\\
\;\;\;\;x + \left(\left(-y\right) \cdot z - a \cdot t\right)\\

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


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

    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 0

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

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

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

        \[\leadsto \left(b \cdot \left(\left(y + t\right) - 2\right) + x\right) - a \cdot \left(t - 1\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\left(y + t\right) - 2\right) \cdot b + x\right) - a \cdot \left(t - 1\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - \color{blue}{a} \cdot \left(t - 1\right) \]
      6. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      8. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot \color{blue}{a} \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot a \]
      11. lift-*.f6472.8

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

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

      \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - -1 \cdot \color{blue}{a} \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(\mathsf{neg}\left(a\right)\right) \]
      2. lower-neg.f6460.3

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

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

    if -5.9999999999999999e-88 < b < 1.19999999999999996e36

    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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

      \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - a \cdot \color{blue}{t}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6477.5

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

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

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

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

        \[\leadsto x + \left(\left(-1 \cdot y\right) \cdot z - a \cdot t\right) \]
      3. mul-1-negN/A

        \[\leadsto x + \left(\left(\mathsf{neg}\left(y\right)\right) \cdot z - a \cdot t\right) \]
      4. lower-neg.f6449.2

        \[\leadsto x + \left(\left(-y\right) \cdot z - a \cdot t\right) \]
    10. Applied rewrites49.2%

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

    if 1.19999999999999996e36 < 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 z around 0

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

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

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

        \[\leadsto \left(b \cdot \left(\left(y + t\right) - 2\right) + x\right) - a \cdot \left(t - 1\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\left(y + t\right) - 2\right) \cdot b + x\right) - a \cdot \left(t - 1\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - \color{blue}{a} \cdot \left(t - 1\right) \]
      6. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      8. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot \color{blue}{a} \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot a \]
      11. lift-*.f6472.8

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

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

      \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - -1 \cdot \color{blue}{a} \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(\mathsf{neg}\left(a\right)\right) \]
      2. lower-neg.f6460.3

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

      \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(-a\right) \]
    8. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \color{blue}{\left(-a\right)} \]
      2. lift-fma.f64N/A

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

        \[\leadsto \left(\left(\left(t + y\right) - 2\right) \cdot b + x\right) - \left(-a\right) \]
      4. lift--.f64N/A

        \[\leadsto \left(\left(\left(t + y\right) - 2\right) \cdot b + x\right) - \left(-a\right) \]
      5. associate--l+N/A

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

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, \color{blue}{b}, x - \left(-a\right)\right) \]
      7. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x - \left(-a\right)\right) \]
      8. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x - \left(-a\right)\right) \]
      9. lower--.f6460.3

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

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

Alternative 10: 67.7% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;b \leq 1.2 \cdot 10^{+36}:\\
\;\;\;\;x + \left(\left(-y\right) \cdot z - a \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -5.9999999999999999e-88 or 1.19999999999999996e36 < 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 z around 0

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

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

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

        \[\leadsto \left(b \cdot \left(\left(y + t\right) - 2\right) + x\right) - a \cdot \left(t - 1\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\left(y + t\right) - 2\right) \cdot b + x\right) - a \cdot \left(t - 1\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - \color{blue}{a} \cdot \left(t - 1\right) \]
      6. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      8. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot \color{blue}{a} \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot a \]
      11. lift-*.f6472.8

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

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

      \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - -1 \cdot \color{blue}{a} \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(\mathsf{neg}\left(a\right)\right) \]
      2. lower-neg.f6460.3

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

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

    if -5.9999999999999999e-88 < b < 1.19999999999999996e36

    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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

      \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - a \cdot \color{blue}{t}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6477.5

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

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

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

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

        \[\leadsto x + \left(\left(-1 \cdot y\right) \cdot z - a \cdot t\right) \]
      3. mul-1-negN/A

        \[\leadsto x + \left(\left(\mathsf{neg}\left(y\right)\right) \cdot z - a \cdot t\right) \]
      4. lower-neg.f6449.2

        \[\leadsto x + \left(\left(-y\right) \cdot z - a \cdot t\right) \]
    10. Applied rewrites49.2%

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

Alternative 11: 67.4% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.9999999999999998e33 or 8e15 < 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. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(b - z\right) \cdot \color{blue}{y} \]
      3. lower--.f6433.5

        \[\leadsto \left(b - z\right) \cdot y \]
    4. Applied rewrites33.5%

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

    if -3.9999999999999998e33 < y < 8e15

    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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

      \[\leadsto x + \left(b \cdot t - \mathsf{fma}\left(\color{blue}{t - 1}, a, -z\right)\right) \]
    6. Step-by-step derivation
      1. lower-*.f6462.4

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

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

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

        \[\leadsto x + \left(b \cdot t - \left(t - 1\right) \cdot a\right) \]
      2. lift--.f64N/A

        \[\leadsto x + \left(b \cdot t - \left(t - 1\right) \cdot a\right) \]
      3. lift-*.f6453.0

        \[\leadsto x + \left(b \cdot t - \left(t - 1\right) \cdot a\right) \]
    10. Applied rewrites53.0%

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

Alternative 12: 66.7% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;b \leq 6 \cdot 10^{+104}:\\
\;\;\;\;x + \left(\left(-y\right) \cdot z - a \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -1.24999999999999996e89 or 5.99999999999999937e104 < 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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

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

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot y + \color{blue}{-1 \cdot \left(t - 2\right)}\right) \]
      2. distribute-lft-outN/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \left(y + \color{blue}{\left(t - 2\right)}\right)\right) \]
      3. associate--l+N/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \left(\left(y + t\right) - 2\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \left(\left(t + y\right) - 2\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \color{blue}{\left(\left(t + y\right) - 2\right)}\right) \]
      6. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(b\right)\right) \cdot \left(-1 \cdot \left(\color{blue}{\left(t + y\right)} - 2\right)\right) \]
      7. lower-neg.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(-1 \cdot \left(\color{blue}{\left(t + y\right)} - 2\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \left(-b\right) \cdot \left(\mathsf{neg}\left(\left(\left(t + y\right) - 2\right)\right)\right) \]
      9. lower-neg.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(-\left(\left(t + y\right) - 2\right)\right) \]
      10. lift--.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(-\left(\left(t + y\right) - 2\right)\right) \]
      11. lift-+.f6437.4

        \[\leadsto \left(-b\right) \cdot \left(-\left(\left(t + y\right) - 2\right)\right) \]
    7. Applied rewrites37.4%

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

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

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

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(2 - \left(t + \color{blue}{y}\right)\right) \]
      3. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(b\right)\right) \cdot \left(2 - \left(t + y\right)\right) \]
      4. lift-neg.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(2 - \left(t + y\right)\right) \]
      5. associate--r+N/A

        \[\leadsto \left(-b\right) \cdot \left(\left(2 - t\right) - y\right) \]
      6. lower--.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(\left(2 - t\right) - y\right) \]
      7. lower--.f6437.4

        \[\leadsto \left(-b\right) \cdot \left(\left(2 - t\right) - y\right) \]
    10. Applied rewrites37.4%

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

    if -1.24999999999999996e89 < b < 5.99999999999999937e104

    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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

      \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - a \cdot \color{blue}{t}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6477.5

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

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

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

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

        \[\leadsto x + \left(\left(-1 \cdot y\right) \cdot z - a \cdot t\right) \]
      3. mul-1-negN/A

        \[\leadsto x + \left(\left(\mathsf{neg}\left(y\right)\right) \cdot z - a \cdot t\right) \]
      4. lower-neg.f6449.2

        \[\leadsto x + \left(\left(-y\right) \cdot z - a \cdot t\right) \]
    10. Applied rewrites49.2%

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

Alternative 13: 66.6% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;y \leq 4 \cdot 10^{+14}:\\
\;\;\;\;x + \left(b \cdot t - \left(\left(-a\right) - z\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.0000000000000002e32 or 4e14 < 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. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(b - z\right) \cdot \color{blue}{y} \]
      3. lower--.f6433.5

        \[\leadsto \left(b - z\right) \cdot y \]
    4. Applied rewrites33.5%

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

    if -7.0000000000000002e32 < y < 4e14

    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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

      \[\leadsto x + \left(b \cdot t - \mathsf{fma}\left(\color{blue}{t - 1}, a, -z\right)\right) \]
    6. Step-by-step derivation
      1. lower-*.f6462.4

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

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

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

        \[\leadsto x + \left(b \cdot t - \left(-1 \cdot a - z\right)\right) \]
      2. mul-1-negN/A

        \[\leadsto x + \left(b \cdot t - \left(\left(\mathsf{neg}\left(a\right)\right) - z\right)\right) \]
      3. lift-neg.f6449.3

        \[\leadsto x + \left(b \cdot t - \left(\left(-a\right) - z\right)\right) \]
    10. Applied rewrites49.3%

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

Alternative 14: 65.8% accurate, 1.2× speedup?

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

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

\mathbf{elif}\;t \leq -8.5 \cdot 10^{+28}:\\
\;\;\;\;\left(b - z\right) \cdot y\\

\mathbf{elif}\;t \leq 7000000000000:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, x\right) - \left(-a\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -7.50000000000000007e71 or 7e12 < 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. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(b - a\right) \cdot \color{blue}{t} \]
      3. lower--.f6432.6

        \[\leadsto \left(b - a\right) \cdot t \]
    4. Applied rewrites32.6%

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

    if -7.50000000000000007e71 < t < -8.49999999999999954e28

    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. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(b - z\right) \cdot \color{blue}{y} \]
      3. lower--.f6433.5

        \[\leadsto \left(b - z\right) \cdot y \]
    4. Applied rewrites33.5%

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

    if -8.49999999999999954e28 < t < 7e12

    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 0

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

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

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

        \[\leadsto \left(b \cdot \left(\left(y + t\right) - 2\right) + x\right) - a \cdot \left(t - 1\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\left(y + t\right) - 2\right) \cdot b + x\right) - a \cdot \left(t - 1\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - \color{blue}{a} \cdot \left(t - 1\right) \]
      6. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      8. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot \color{blue}{a} \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot a \]
      11. lift-*.f6472.8

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

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

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

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

        \[\leadsto \left(b \cdot \left(y - 2\right) + x\right) - -1 \cdot a \]
      3. *-commutativeN/A

        \[\leadsto \left(\left(y - 2\right) \cdot b + x\right) - -1 \cdot a \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(y - 2, b, x\right) - -1 \cdot a \]
      5. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(y - 2, b, x\right) - -1 \cdot a \]
      6. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(y - 2, b, x\right) - \left(\mathsf{neg}\left(a\right)\right) \]
      7. lower-neg.f6446.7

        \[\leadsto \mathsf{fma}\left(y - 2, b, x\right) - \left(-a\right) \]
    7. Applied rewrites46.7%

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

Alternative 15: 64.6% accurate, 1.4× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.0000000000000002e32 or 4e14 < 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. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(b - z\right) \cdot \color{blue}{y} \]
      3. lower--.f6433.5

        \[\leadsto \left(b - z\right) \cdot y \]
    4. Applied rewrites33.5%

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

    if -7.0000000000000002e32 < y < 4e14

    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 0

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

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

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

        \[\leadsto \left(b \cdot \left(\left(y + t\right) - 2\right) + x\right) - a \cdot \left(t - 1\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\left(y + t\right) - 2\right) \cdot b + x\right) - a \cdot \left(t - 1\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - \color{blue}{a} \cdot \left(t - 1\right) \]
      6. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      8. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot \color{blue}{a} \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot a \]
      11. lift-*.f6472.8

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

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

      \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - -1 \cdot \color{blue}{a} \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(\mathsf{neg}\left(a\right)\right) \]
      2. lower-neg.f6460.3

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

      \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(-a\right) \]
    8. Taylor expanded in y around 0

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

        \[\leadsto \left(b \cdot \left(t - 2\right) + x\right) - \left(-a\right) \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(t - 2\right) \cdot b + x\right) - \left(-a\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \left(-a\right) \]
      4. lower--.f6446.4

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \left(-a\right) \]
    10. Applied rewrites46.4%

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

Alternative 16: 57.1% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;y \leq -5.4 \cdot 10^{-97}:\\
\;\;\;\;\left(b - a\right) \cdot t\\

\mathbf{elif}\;y \leq 3.5 \cdot 10^{+14}:\\
\;\;\;\;x - a \cdot \left(t - 1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.8e12 or 3.5e14 < 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. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(b - z\right) \cdot \color{blue}{y} \]
      3. lower--.f6433.5

        \[\leadsto \left(b - z\right) \cdot y \]
    4. Applied rewrites33.5%

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

    if -4.8e12 < y < -5.3999999999999997e-97

    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. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(b - a\right) \cdot \color{blue}{t} \]
      3. lower--.f6432.6

        \[\leadsto \left(b - a\right) \cdot t \]
    4. Applied rewrites32.6%

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

    if -5.3999999999999997e-97 < y < 3.5e14

    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 0

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

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

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

        \[\leadsto \left(b \cdot \left(\left(y + t\right) - 2\right) + x\right) - a \cdot \left(t - 1\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\left(y + t\right) - 2\right) \cdot b + x\right) - a \cdot \left(t - 1\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - \color{blue}{a} \cdot \left(t - 1\right) \]
      6. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      8. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - a \cdot \left(t - 1\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot \color{blue}{a} \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot a \]
      11. lift-*.f6472.8

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

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

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

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

        \[\leadsto \left(\left(t - 2\right) \cdot b + x\right) - \left(t - 1\right) \cdot a \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \left(t - \color{blue}{1}\right) \cdot a \]
      4. lift--.f6459.4

        \[\leadsto \mathsf{fma}\left(t - 2, b, x\right) - \left(t - 1\right) \cdot a \]
    7. Applied rewrites59.4%

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

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

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

        \[\leadsto x - a \cdot \left(t - \color{blue}{1}\right) \]
      3. lift--.f6441.5

        \[\leadsto x - a \cdot \left(t - 1\right) \]
    10. Applied rewrites41.5%

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

Alternative 17: 51.9% accurate, 2.0× speedup?

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

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

\mathbf{elif}\;y \leq 44000:\\
\;\;\;\;\left(b - a\right) \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.8e12 or 44000 < 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. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(b - z\right) \cdot \color{blue}{y} \]
      3. lower--.f6433.5

        \[\leadsto \left(b - z\right) \cdot y \]
    4. Applied rewrites33.5%

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

    if -4.8e12 < y < 44000

    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. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(b - a\right) \cdot \color{blue}{t} \]
      3. lower--.f6432.6

        \[\leadsto \left(b - a\right) \cdot t \]
    4. Applied rewrites32.6%

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

Alternative 18: 47.6% accurate, 2.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -5.80000000000000014e71 or 2.2499999999999999e58 < 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. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(b - a\right) \cdot \color{blue}{t} \]
      3. lower--.f6432.6

        \[\leadsto \left(b - a\right) \cdot t \]
    4. Applied rewrites32.6%

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

    if -5.80000000000000014e71 < t < 2.2499999999999999e58

    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. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(1 - y\right) \cdot \color{blue}{z} \]
      3. lower--.f6429.0

        \[\leadsto \left(1 - y\right) \cdot z \]
    4. Applied rewrites29.0%

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

Alternative 19: 43.1% accurate, 2.0× speedup?

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

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

\mathbf{elif}\;z \leq 2.6 \cdot 10^{+21}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1e76 or 2.6e21 < z

    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. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(1 - y\right) \cdot \color{blue}{z} \]
      3. lower--.f6429.0

        \[\leadsto \left(1 - y\right) \cdot z \]
    4. Applied rewrites29.0%

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

    if -1e76 < z < 2.6e21

    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. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(1 - t\right) \cdot a \]
    4. Applied rewrites27.3%

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

Alternative 20: 33.2% accurate, 2.0× speedup?

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

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

\mathbf{elif}\;y \leq 2.85:\\
\;\;\;\;\left(1 - t\right) \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.25e14 or 2.85000000000000009 < 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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

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

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot y + \color{blue}{-1 \cdot \left(t - 2\right)}\right) \]
      2. distribute-lft-outN/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \left(y + \color{blue}{\left(t - 2\right)}\right)\right) \]
      3. associate--l+N/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \left(\left(y + t\right) - 2\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \left(\left(t + y\right) - 2\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \color{blue}{\left(\left(t + y\right) - 2\right)}\right) \]
      6. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(b\right)\right) \cdot \left(-1 \cdot \left(\color{blue}{\left(t + y\right)} - 2\right)\right) \]
      7. lower-neg.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(-1 \cdot \left(\color{blue}{\left(t + y\right)} - 2\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \left(-b\right) \cdot \left(\mathsf{neg}\left(\left(\left(t + y\right) - 2\right)\right)\right) \]
      9. lower-neg.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(-\left(\left(t + y\right) - 2\right)\right) \]
      10. lift--.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(-\left(\left(t + y\right) - 2\right)\right) \]
      11. lift-+.f6437.4

        \[\leadsto \left(-b\right) \cdot \left(-\left(\left(t + y\right) - 2\right)\right) \]
    7. Applied rewrites37.4%

      \[\leadsto \left(-b\right) \cdot \color{blue}{\left(-\left(\left(t + y\right) - 2\right)\right)} \]
    8. Taylor expanded in y around inf

      \[\leadsto b \cdot y \]
    9. Step-by-step derivation
      1. lower-*.f6417.8

        \[\leadsto b \cdot y \]
    10. Applied rewrites17.8%

      \[\leadsto b \cdot y \]

    if -2.25e14 < y < 2.85000000000000009

    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. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(1 - t\right) \cdot a \]
    4. Applied rewrites27.3%

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

Alternative 21: 27.5% accurate, 2.3× speedup?

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

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

\mathbf{elif}\;y \leq 2.85:\\
\;\;\;\;\left(-t\right) \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2e14 or 2.85000000000000009 < 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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

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

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot y + \color{blue}{-1 \cdot \left(t - 2\right)}\right) \]
      2. distribute-lft-outN/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \left(y + \color{blue}{\left(t - 2\right)}\right)\right) \]
      3. associate--l+N/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \left(\left(y + t\right) - 2\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \left(\left(t + y\right) - 2\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \color{blue}{\left(\left(t + y\right) - 2\right)}\right) \]
      6. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(b\right)\right) \cdot \left(-1 \cdot \left(\color{blue}{\left(t + y\right)} - 2\right)\right) \]
      7. lower-neg.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(-1 \cdot \left(\color{blue}{\left(t + y\right)} - 2\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \left(-b\right) \cdot \left(\mathsf{neg}\left(\left(\left(t + y\right) - 2\right)\right)\right) \]
      9. lower-neg.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(-\left(\left(t + y\right) - 2\right)\right) \]
      10. lift--.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(-\left(\left(t + y\right) - 2\right)\right) \]
      11. lift-+.f6437.4

        \[\leadsto \left(-b\right) \cdot \left(-\left(\left(t + y\right) - 2\right)\right) \]
    7. Applied rewrites37.4%

      \[\leadsto \left(-b\right) \cdot \color{blue}{\left(-\left(\left(t + y\right) - 2\right)\right)} \]
    8. Taylor expanded in y around inf

      \[\leadsto b \cdot y \]
    9. Step-by-step derivation
      1. lower-*.f6417.8

        \[\leadsto b \cdot y \]
    10. Applied rewrites17.8%

      \[\leadsto b \cdot y \]

    if -2e14 < y < 2.85000000000000009

    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. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(1 - t\right) \cdot a \]
    4. Applied rewrites27.3%

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

      \[\leadsto \left(-1 \cdot t\right) \cdot a \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(t\right)\right) \cdot a \]
      2. lower-neg.f6418.8

        \[\leadsto \left(-t\right) \cdot a \]
    7. Applied rewrites18.8%

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

Alternative 22: 22.8% accurate, 2.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-51}:\\
\;\;\;\;b \cdot y\\

\mathbf{elif}\;y \leq 2.1:\\
\;\;\;\;a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.2e-51 or 2.10000000000000009 < 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 0

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \left(-1 \cdot z + a \cdot \left(t - 1\right)\right)\right) \]
      11. +-commutativeN/A

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

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

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

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -1 \cdot z\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, \mathsf{neg}\left(z\right)\right)\right) \]
      16. lower-neg.f6496.2

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

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

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

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot y + \color{blue}{-1 \cdot \left(t - 2\right)}\right) \]
      2. distribute-lft-outN/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \left(y + \color{blue}{\left(t - 2\right)}\right)\right) \]
      3. associate--l+N/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \left(\left(y + t\right) - 2\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \left(\left(t + y\right) - 2\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot b\right) \cdot \left(-1 \cdot \color{blue}{\left(\left(t + y\right) - 2\right)}\right) \]
      6. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(b\right)\right) \cdot \left(-1 \cdot \left(\color{blue}{\left(t + y\right)} - 2\right)\right) \]
      7. lower-neg.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(-1 \cdot \left(\color{blue}{\left(t + y\right)} - 2\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \left(-b\right) \cdot \left(\mathsf{neg}\left(\left(\left(t + y\right) - 2\right)\right)\right) \]
      9. lower-neg.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(-\left(\left(t + y\right) - 2\right)\right) \]
      10. lift--.f64N/A

        \[\leadsto \left(-b\right) \cdot \left(-\left(\left(t + y\right) - 2\right)\right) \]
      11. lift-+.f6437.4

        \[\leadsto \left(-b\right) \cdot \left(-\left(\left(t + y\right) - 2\right)\right) \]
    7. Applied rewrites37.4%

      \[\leadsto \left(-b\right) \cdot \color{blue}{\left(-\left(\left(t + y\right) - 2\right)\right)} \]
    8. Taylor expanded in y around inf

      \[\leadsto b \cdot y \]
    9. Step-by-step derivation
      1. lower-*.f6417.8

        \[\leadsto b \cdot y \]
    10. Applied rewrites17.8%

      \[\leadsto b \cdot y \]

    if -3.2e-51 < y < 2.10000000000000009

    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. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(1 - t\right) \cdot a \]
    4. Applied rewrites27.3%

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

      \[\leadsto a \]
    6. Step-by-step derivation
      1. Applied rewrites10.6%

        \[\leadsto a \]
    7. Recombined 2 regimes into one program.
    8. Add Preprocessing

    Alternative 23: 10.6% 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. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(1 - t\right) \cdot a \]
    4. Applied rewrites27.3%

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

      \[\leadsto a \]
    6. Step-by-step derivation
      1. Applied rewrites10.6%

        \[\leadsto a \]
      2. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 2025127 
      (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)))