Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.8% → 96.6%
Time: 5.6s
Alternatives: 12
Speedup: 1.0×

Specification

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 92.8% accurate, 1.0× speedup?

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

Alternative 1: 96.6% accurate, 0.5× speedup?

\[\begin{array}{l} t_1 := \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\ \mathbf{if}\;t\_1 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y + a \cdot b\right)\\ \end{array} \]
(FPCore (x y z t a b)
  :precision binary64
  (let* ((t_1 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b))))
  (if (<= t_1 INFINITY) t_1 (* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((x + (y * z)) + (t * a)) + ((a * z) * b);
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = z * (y + (a * b));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((x + (y * z)) + (t * a)) + ((a * z) * b);
	double tmp;
	if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = z * (y + (a * b));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = ((x + (y * z)) + (t * a)) + ((a * z) * b)
	tmp = 0
	if t_1 <= math.inf:
		tmp = t_1
	else:
		tmp = z * (y + (a * b))
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(z * Float64(y + Float64(a * b)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = ((x + (y * z)) + (t * a)) + ((a * z) * b);
	tmp = 0.0;
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = z * (y + (a * b));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\


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

    1. Initial program 92.8%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]

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

    1. Initial program 92.8%

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

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

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

        \[\leadsto z \cdot \left(y + \color{blue}{a \cdot b}\right) \]
      3. lower-*.f6452.1%

        \[\leadsto z \cdot \left(y + a \cdot \color{blue}{b}\right) \]
    4. Applied rewrites52.1%

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

Alternative 2: 94.7% accurate, 1.0× speedup?

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

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.4e136

    1. Initial program 92.8%

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

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

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

        \[\leadsto z \cdot \left(y + \color{blue}{a \cdot b}\right) \]
      3. lower-*.f6452.1%

        \[\leadsto z \cdot \left(y + a \cdot \color{blue}{b}\right) \]
    4. Applied rewrites52.1%

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

    if -2.4e136 < z

    1. Initial program 92.8%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
      3. fp-cancel-sign-sub-invN/A

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

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

        \[\leadsto \left(\color{blue}{\left(x + y \cdot z\right)} + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
      6. associate-+l+N/A

        \[\leadsto \color{blue}{\left(x + \left(y \cdot z + t \cdot a\right)\right)} - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
      7. associate--l+N/A

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

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

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

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

Alternative 3: 86.1% accurate, 0.9× speedup?

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

\mathbf{elif}\;t \leq 204999999999999997902848:\\
\;\;\;\;x + \left(a \cdot \left(b \cdot z\right) + y \cdot z\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.6e-142 or 2.05e23 < t

    1. Initial program 92.8%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
      3. fp-cancel-sign-sub-invN/A

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

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

        \[\leadsto \left(\color{blue}{\left(x + y \cdot z\right)} + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
      6. associate-+l+N/A

        \[\leadsto \color{blue}{\left(x + \left(y \cdot z + t \cdot a\right)\right)} - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
      7. associate--l+N/A

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

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

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

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

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

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

      if -3.6e-142 < t < 2.05e23

      1. Initial program 92.8%

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

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

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

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

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

          \[\leadsto x + \left(a \cdot \left(b \cdot z\right) + y \cdot z\right) \]
        5. lower-*.f6470.9%

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

        \[\leadsto \color{blue}{x + \left(a \cdot \left(b \cdot z\right) + y \cdot z\right)} \]
    6. Recombined 2 regimes into one program.
    7. Add Preprocessing

    Alternative 4: 83.6% accurate, 1.0× speedup?

    \[\begin{array}{l} t_1 := \left(t \cdot a + z \cdot y\right) + x\\ \mathbf{if}\;y \leq \frac{-8652089692998945}{23384026197294446691258957323460528314494920687616}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 13000000000000000250220688488498292662086011053465034426066648794239336448:\\ \;\;\;\;a \cdot \left(t + b \cdot z\right) + x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
    (FPCore (x y z t a b)
      :precision binary64
      (let* ((t_1 (+ (+ (* t a) (* z y)) x)))
      (if (<=
           y
           -8652089692998945/23384026197294446691258957323460528314494920687616)
        t_1
        (if (<=
             y
             13000000000000000250220688488498292662086011053465034426066648794239336448)
          (+ (* a (+ t (* b z))) x)
          t_1))))
    double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = ((t * a) + (z * y)) + x;
    	double tmp;
    	if (y <= -3.7e-34) {
    		tmp = t_1;
    	} else if (y <= 1.3e+73) {
    		tmp = (a * (t + (b * z))) + x;
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(x, y, z, t, a, b)
    use fmin_fmax_functions
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8) :: t_1
        real(8) :: tmp
        t_1 = ((t * a) + (z * y)) + x
        if (y <= (-3.7d-34)) then
            tmp = t_1
        else if (y <= 1.3d+73) then
            tmp = (a * (t + (b * z))) + x
        else
            tmp = t_1
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = ((t * a) + (z * y)) + x;
    	double tmp;
    	if (y <= -3.7e-34) {
    		tmp = t_1;
    	} else if (y <= 1.3e+73) {
    		tmp = (a * (t + (b * z))) + x;
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t, a, b):
    	t_1 = ((t * a) + (z * y)) + x
    	tmp = 0
    	if y <= -3.7e-34:
    		tmp = t_1
    	elif y <= 1.3e+73:
    		tmp = (a * (t + (b * z))) + x
    	else:
    		tmp = t_1
    	return tmp
    
    function code(x, y, z, t, a, b)
    	t_1 = Float64(Float64(Float64(t * a) + Float64(z * y)) + x)
    	tmp = 0.0
    	if (y <= -3.7e-34)
    		tmp = t_1;
    	elseif (y <= 1.3e+73)
    		tmp = Float64(Float64(a * Float64(t + Float64(b * z))) + x);
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t, a, b)
    	t_1 = ((t * a) + (z * y)) + x;
    	tmp = 0.0;
    	if (y <= -3.7e-34)
    		tmp = t_1;
    	elseif (y <= 1.3e+73)
    		tmp = (a * (t + (b * z))) + x;
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t * a), $MachinePrecision] + N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -8652089692998945/23384026197294446691258957323460528314494920687616], t$95$1, If[LessEqual[y, 13000000000000000250220688488498292662086011053465034426066648794239336448], N[(N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    t_1 := \left(t \cdot a + z \cdot y\right) + x\\
    \mathbf{if}\;y \leq \frac{-8652089692998945}{23384026197294446691258957323460528314494920687616}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;y \leq 13000000000000000250220688488498292662086011053465034426066648794239336448:\\
    \;\;\;\;a \cdot \left(t + b \cdot z\right) + x\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -3.6999999999999999e-34 or 1.3e73 < y

      1. Initial program 92.8%

        \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
      2. Step-by-step derivation
        1. lift-+.f64N/A

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

          \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
        3. fp-cancel-sign-sub-invN/A

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

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

          \[\leadsto \left(\color{blue}{\left(x + y \cdot z\right)} + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
        6. associate-+l+N/A

          \[\leadsto \color{blue}{\left(x + \left(y \cdot z + t \cdot a\right)\right)} - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
        7. associate--l+N/A

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

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

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

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

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

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

        if -3.6999999999999999e-34 < y < 1.3e73

        1. Initial program 92.8%

          \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

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

            \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
          3. fp-cancel-sign-sub-invN/A

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

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

            \[\leadsto \left(\color{blue}{\left(x + y \cdot z\right)} + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
          6. associate-+l+N/A

            \[\leadsto \color{blue}{\left(x + \left(y \cdot z + t \cdot a\right)\right)} - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
          7. associate--l+N/A

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

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

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

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

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

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

            \[\leadsto a \cdot \left(t + \color{blue}{b \cdot z}\right) + x \]
          3. lower-*.f6473.7%

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

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

      Alternative 5: 82.2% accurate, 1.0× speedup?

      \[\begin{array}{l} t_1 := z \cdot \left(y + a \cdot b\right)\\ \mathbf{if}\;z \leq -2199999999999999885260233413848058330640843229616793674173628649221800130588415029452562203177085987418885945263028424059069640212480:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 35999999999999999245740906339966790167030859524511658159104163103288924474876839835625062400:\\ \;\;\;\;a \cdot \left(t + b \cdot z\right) + x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
      (FPCore (x y z t a b)
        :precision binary64
        (let* ((t_1 (* z (+ y (* a b)))))
        (if (<=
             z
             -2199999999999999885260233413848058330640843229616793674173628649221800130588415029452562203177085987418885945263028424059069640212480)
          t_1
          (if (<=
               z
               35999999999999999245740906339966790167030859524511658159104163103288924474876839835625062400)
            (+ (* a (+ t (* b z))) x)
            t_1))))
      double code(double x, double y, double z, double t, double a, double b) {
      	double t_1 = z * (y + (a * b));
      	double tmp;
      	if (z <= -2.2e+132) {
      		tmp = t_1;
      	} else if (z <= 3.6e+91) {
      		tmp = (a * (t + (b * z))) + x;
      	} 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 + (a * b))
          if (z <= (-2.2d+132)) then
              tmp = t_1
          else if (z <= 3.6d+91) then
              tmp = (a * (t + (b * z))) + x
          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 + (a * b));
      	double tmp;
      	if (z <= -2.2e+132) {
      		tmp = t_1;
      	} else if (z <= 3.6e+91) {
      		tmp = (a * (t + (b * z))) + x;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      def code(x, y, z, t, a, b):
      	t_1 = z * (y + (a * b))
      	tmp = 0
      	if z <= -2.2e+132:
      		tmp = t_1
      	elif z <= 3.6e+91:
      		tmp = (a * (t + (b * z))) + x
      	else:
      		tmp = t_1
      	return tmp
      
      function code(x, y, z, t, a, b)
      	t_1 = Float64(z * Float64(y + Float64(a * b)))
      	tmp = 0.0
      	if (z <= -2.2e+132)
      		tmp = t_1;
      	elseif (z <= 3.6e+91)
      		tmp = Float64(Float64(a * Float64(t + Float64(b * z))) + x);
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z, t, a, b)
      	t_1 = z * (y + (a * b));
      	tmp = 0.0;
      	if (z <= -2.2e+132)
      		tmp = t_1;
      	elseif (z <= 3.6e+91)
      		tmp = (a * (t + (b * z))) + x;
      	else
      		tmp = t_1;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2199999999999999885260233413848058330640843229616793674173628649221800130588415029452562203177085987418885945263028424059069640212480], t$95$1, If[LessEqual[z, 35999999999999999245740906339966790167030859524511658159104163103288924474876839835625062400], N[(N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
      
      \begin{array}{l}
      t_1 := z \cdot \left(y + a \cdot b\right)\\
      \mathbf{if}\;z \leq -2199999999999999885260233413848058330640843229616793674173628649221800130588415029452562203177085987418885945263028424059069640212480:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;z \leq 35999999999999999245740906339966790167030859524511658159104163103288924474876839835625062400:\\
      \;\;\;\;a \cdot \left(t + b \cdot z\right) + x\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z < -2.1999999999999999e132 or 3.5999999999999999e91 < z

        1. Initial program 92.8%

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

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

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

            \[\leadsto z \cdot \left(y + \color{blue}{a \cdot b}\right) \]
          3. lower-*.f6452.1%

            \[\leadsto z \cdot \left(y + a \cdot \color{blue}{b}\right) \]
        4. Applied rewrites52.1%

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

        if -2.1999999999999999e132 < z < 3.5999999999999999e91

        1. Initial program 92.8%

          \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

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

            \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
          3. fp-cancel-sign-sub-invN/A

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

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

            \[\leadsto \left(\color{blue}{\left(x + y \cdot z\right)} + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
          6. associate-+l+N/A

            \[\leadsto \color{blue}{\left(x + \left(y \cdot z + t \cdot a\right)\right)} - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
          7. associate--l+N/A

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

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

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

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

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

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

            \[\leadsto a \cdot \left(t + \color{blue}{b \cdot z}\right) + x \]
          3. lower-*.f6473.7%

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

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

      Alternative 6: 73.9% accurate, 0.9× speedup?

      \[\begin{array}{l} t_1 := z \cdot \left(y + a \cdot b\right)\\ \mathbf{if}\;z \leq \frac{-2374940160662717}{91343852333181432387730302044767688728495783936}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq \frac{3470978933371479}{266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072}:\\ \;\;\;\;a \cdot t + x\\ \mathbf{elif}\;z \leq 299999999999999999088617516181804470671953197798974385752637440:\\ \;\;\;\;x + \left(a \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
      (FPCore (x y z t a b)
        :precision binary64
        (let* ((t_1 (* z (+ y (* a b)))))
        (if (<=
             z
             -2374940160662717/91343852333181432387730302044767688728495783936)
          t_1
          (if (<=
               z
               3470978933371479/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072)
            (+ (* a t) x)
            (if (<=
                 z
                 299999999999999999088617516181804470671953197798974385752637440)
              (+ x (* (* a z) b))
              t_1)))))
      double code(double x, double y, double z, double t, double a, double b) {
      	double t_1 = z * (y + (a * b));
      	double tmp;
      	if (z <= -2.6e-32) {
      		tmp = t_1;
      	} else if (z <= 1.3e-80) {
      		tmp = (a * t) + x;
      	} else if (z <= 3e+62) {
      		tmp = x + ((a * z) * b);
      	} 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 + (a * b))
          if (z <= (-2.6d-32)) then
              tmp = t_1
          else if (z <= 1.3d-80) then
              tmp = (a * t) + x
          else if (z <= 3d+62) then
              tmp = x + ((a * z) * b)
          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 + (a * b));
      	double tmp;
      	if (z <= -2.6e-32) {
      		tmp = t_1;
      	} else if (z <= 1.3e-80) {
      		tmp = (a * t) + x;
      	} else if (z <= 3e+62) {
      		tmp = x + ((a * z) * b);
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      def code(x, y, z, t, a, b):
      	t_1 = z * (y + (a * b))
      	tmp = 0
      	if z <= -2.6e-32:
      		tmp = t_1
      	elif z <= 1.3e-80:
      		tmp = (a * t) + x
      	elif z <= 3e+62:
      		tmp = x + ((a * z) * b)
      	else:
      		tmp = t_1
      	return tmp
      
      function code(x, y, z, t, a, b)
      	t_1 = Float64(z * Float64(y + Float64(a * b)))
      	tmp = 0.0
      	if (z <= -2.6e-32)
      		tmp = t_1;
      	elseif (z <= 1.3e-80)
      		tmp = Float64(Float64(a * t) + x);
      	elseif (z <= 3e+62)
      		tmp = Float64(x + Float64(Float64(a * z) * b));
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z, t, a, b)
      	t_1 = z * (y + (a * b));
      	tmp = 0.0;
      	if (z <= -2.6e-32)
      		tmp = t_1;
      	elseif (z <= 1.3e-80)
      		tmp = (a * t) + x;
      	elseif (z <= 3e+62)
      		tmp = x + ((a * z) * b);
      	else
      		tmp = t_1;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2374940160662717/91343852333181432387730302044767688728495783936], t$95$1, If[LessEqual[z, 3470978933371479/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072], N[(N[(a * t), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 299999999999999999088617516181804470671953197798974385752637440], N[(x + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
      
      \begin{array}{l}
      t_1 := z \cdot \left(y + a \cdot b\right)\\
      \mathbf{if}\;z \leq \frac{-2374940160662717}{91343852333181432387730302044767688728495783936}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;z \leq \frac{3470978933371479}{266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072}:\\
      \;\;\;\;a \cdot t + x\\
      
      \mathbf{elif}\;z \leq 299999999999999999088617516181804470671953197798974385752637440:\\
      \;\;\;\;x + \left(a \cdot z\right) \cdot b\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if z < -2.5999999999999997e-32 or 3e62 < z

        1. Initial program 92.8%

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

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

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

            \[\leadsto z \cdot \left(y + \color{blue}{a \cdot b}\right) \]
          3. lower-*.f6452.1%

            \[\leadsto z \cdot \left(y + a \cdot \color{blue}{b}\right) \]
        4. Applied rewrites52.1%

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

        if -2.5999999999999997e-32 < z < 1.3e-80

        1. Initial program 92.8%

          \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

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

            \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
          3. fp-cancel-sign-sub-invN/A

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

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

            \[\leadsto \left(\color{blue}{\left(x + y \cdot z\right)} + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
          6. associate-+l+N/A

            \[\leadsto \color{blue}{\left(x + \left(y \cdot z + t \cdot a\right)\right)} - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
          7. associate--l+N/A

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

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

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

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

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

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

            \[\leadsto a \cdot \left(t + \color{blue}{b \cdot z}\right) + x \]
          3. lower-*.f6473.7%

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

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

          \[\leadsto a \cdot t + x \]
        8. Step-by-step derivation
          1. Applied rewrites50.8%

            \[\leadsto a \cdot t + x \]

          if 1.3e-80 < z < 3e62

          1. Initial program 92.8%

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

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

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

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

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

              \[\leadsto x + \left(a \cdot t + a \cdot \color{blue}{\left(b \cdot z\right)}\right) \]
            5. lower-*.f6471.4%

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

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

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

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

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

              \[\leadsto a \cdot t + a \cdot \left(b \cdot \color{blue}{z}\right) \]
            4. lower-*.f6448.4%

              \[\leadsto a \cdot t + a \cdot \left(b \cdot z\right) \]
          7. Applied rewrites48.4%

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

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

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

              \[\leadsto x + a \cdot \left(b \cdot \color{blue}{z}\right) \]
            3. lower-*.f6450.1%

              \[\leadsto x + a \cdot \left(b \cdot z\right) \]
          10. Applied rewrites50.1%

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

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

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

              \[\leadsto x + a \cdot \left(z \cdot b\right) \]
            4. associate-*l*N/A

              \[\leadsto x + \left(a \cdot z\right) \cdot b \]
            5. lift-*.f64N/A

              \[\leadsto x + \left(a \cdot z\right) \cdot b \]
            6. lift-*.f6451.3%

              \[\leadsto x + \left(a \cdot z\right) \cdot b \]
          12. Applied rewrites51.3%

            \[\leadsto x + \left(a \cdot z\right) \cdot b \]
        9. Recombined 3 regimes into one program.
        10. Add Preprocessing

        Alternative 7: 62.4% accurate, 1.2× speedup?

        \[\begin{array}{l} \mathbf{if}\;z \leq \frac{-2374940160662717}{91343852333181432387730302044767688728495783936}:\\ \;\;\;\;a \cdot \left(t + b \cdot z\right)\\ \mathbf{elif}\;z \leq \frac{3470978933371479}{266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072}:\\ \;\;\;\;a \cdot t + x\\ \mathbf{else}:\\ \;\;\;\;x + \left(a \cdot z\right) \cdot b\\ \end{array} \]
        (FPCore (x y z t a b)
          :precision binary64
          (if (<=
             z
             -2374940160662717/91343852333181432387730302044767688728495783936)
          (* a (+ t (* b z)))
          (if (<=
               z
               3470978933371479/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072)
            (+ (* a t) x)
            (+ x (* (* a z) b)))))
        double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if (z <= -2.6e-32) {
        		tmp = a * (t + (b * z));
        	} else if (z <= 1.3e-80) {
        		tmp = (a * t) + x;
        	} else {
        		tmp = x + ((a * z) * b);
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(x, y, z, t, a, b)
        use fmin_fmax_functions
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8), intent (in) :: t
            real(8), intent (in) :: a
            real(8), intent (in) :: b
            real(8) :: tmp
            if (z <= (-2.6d-32)) then
                tmp = a * (t + (b * z))
            else if (z <= 1.3d-80) then
                tmp = (a * t) + x
            else
                tmp = x + ((a * z) * b)
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if (z <= -2.6e-32) {
        		tmp = a * (t + (b * z));
        	} else if (z <= 1.3e-80) {
        		tmp = (a * t) + x;
        	} else {
        		tmp = x + ((a * z) * b);
        	}
        	return tmp;
        }
        
        def code(x, y, z, t, a, b):
        	tmp = 0
        	if z <= -2.6e-32:
        		tmp = a * (t + (b * z))
        	elif z <= 1.3e-80:
        		tmp = (a * t) + x
        	else:
        		tmp = x + ((a * z) * b)
        	return tmp
        
        function code(x, y, z, t, a, b)
        	tmp = 0.0
        	if (z <= -2.6e-32)
        		tmp = Float64(a * Float64(t + Float64(b * z)));
        	elseif (z <= 1.3e-80)
        		tmp = Float64(Float64(a * t) + x);
        	else
        		tmp = Float64(x + Float64(Float64(a * z) * b));
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z, t, a, b)
        	tmp = 0.0;
        	if (z <= -2.6e-32)
        		tmp = a * (t + (b * z));
        	elseif (z <= 1.3e-80)
        		tmp = (a * t) + x;
        	else
        		tmp = x + ((a * z) * b);
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2374940160662717/91343852333181432387730302044767688728495783936], N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3470978933371479/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072], N[(N[(a * t), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        \mathbf{if}\;z \leq \frac{-2374940160662717}{91343852333181432387730302044767688728495783936}:\\
        \;\;\;\;a \cdot \left(t + b \cdot z\right)\\
        
        \mathbf{elif}\;z \leq \frac{3470978933371479}{266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072}:\\
        \;\;\;\;a \cdot t + x\\
        
        \mathbf{else}:\\
        \;\;\;\;x + \left(a \cdot z\right) \cdot b\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if z < -2.5999999999999997e-32

          1. Initial program 92.8%

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

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

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

              \[\leadsto a \cdot \left(t + \color{blue}{b \cdot z}\right) \]
            3. lower-*.f6450.7%

              \[\leadsto a \cdot \left(t + b \cdot \color{blue}{z}\right) \]
          4. Applied rewrites50.7%

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

          if -2.5999999999999997e-32 < z < 1.3e-80

          1. Initial program 92.8%

            \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

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

              \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
            3. fp-cancel-sign-sub-invN/A

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

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

              \[\leadsto \left(\color{blue}{\left(x + y \cdot z\right)} + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
            6. associate-+l+N/A

              \[\leadsto \color{blue}{\left(x + \left(y \cdot z + t \cdot a\right)\right)} - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
            7. associate--l+N/A

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

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

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

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

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

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

              \[\leadsto a \cdot \left(t + \color{blue}{b \cdot z}\right) + x \]
            3. lower-*.f6473.7%

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

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

            \[\leadsto a \cdot t + x \]
          8. Step-by-step derivation
            1. Applied rewrites50.8%

              \[\leadsto a \cdot t + x \]

            if 1.3e-80 < z

            1. Initial program 92.8%

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

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

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

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

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

                \[\leadsto x + \left(a \cdot t + a \cdot \color{blue}{\left(b \cdot z\right)}\right) \]
              5. lower-*.f6471.4%

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

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

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

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

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

                \[\leadsto a \cdot t + a \cdot \left(b \cdot \color{blue}{z}\right) \]
              4. lower-*.f6448.4%

                \[\leadsto a \cdot t + a \cdot \left(b \cdot z\right) \]
            7. Applied rewrites48.4%

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

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

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

                \[\leadsto x + a \cdot \left(b \cdot \color{blue}{z}\right) \]
              3. lower-*.f6450.1%

                \[\leadsto x + a \cdot \left(b \cdot z\right) \]
            10. Applied rewrites50.1%

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

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

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

                \[\leadsto x + a \cdot \left(z \cdot b\right) \]
              4. associate-*l*N/A

                \[\leadsto x + \left(a \cdot z\right) \cdot b \]
              5. lift-*.f64N/A

                \[\leadsto x + \left(a \cdot z\right) \cdot b \]
              6. lift-*.f6451.3%

                \[\leadsto x + \left(a \cdot z\right) \cdot b \]
            12. Applied rewrites51.3%

              \[\leadsto x + \left(a \cdot z\right) \cdot b \]
          9. Recombined 3 regimes into one program.
          10. Add Preprocessing

          Alternative 8: 61.5% accurate, 1.2× speedup?

          \[\begin{array}{l} t_1 := x + \left(a \cdot z\right) \cdot b\\ \mathbf{if}\;z \leq \frac{-2374940160662717}{91343852333181432387730302044767688728495783936}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq \frac{3470978933371479}{266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072}:\\ \;\;\;\;a \cdot t + x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
          (FPCore (x y z t a b)
            :precision binary64
            (let* ((t_1 (+ x (* (* a z) b))))
            (if (<=
                 z
                 -2374940160662717/91343852333181432387730302044767688728495783936)
              t_1
              (if (<=
                   z
                   3470978933371479/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072)
                (+ (* a t) x)
                t_1))))
          double code(double x, double y, double z, double t, double a, double b) {
          	double t_1 = x + ((a * z) * b);
          	double tmp;
          	if (z <= -2.6e-32) {
          		tmp = t_1;
          	} else if (z <= 1.3e-80) {
          		tmp = (a * t) + x;
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x, y, z, t, a, b)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8), intent (in) :: t
              real(8), intent (in) :: a
              real(8), intent (in) :: b
              real(8) :: t_1
              real(8) :: tmp
              t_1 = x + ((a * z) * b)
              if (z <= (-2.6d-32)) then
                  tmp = t_1
              else if (z <= 1.3d-80) then
                  tmp = (a * t) + x
              else
                  tmp = t_1
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z, double t, double a, double b) {
          	double t_1 = x + ((a * z) * b);
          	double tmp;
          	if (z <= -2.6e-32) {
          		tmp = t_1;
          	} else if (z <= 1.3e-80) {
          		tmp = (a * t) + x;
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          def code(x, y, z, t, a, b):
          	t_1 = x + ((a * z) * b)
          	tmp = 0
          	if z <= -2.6e-32:
          		tmp = t_1
          	elif z <= 1.3e-80:
          		tmp = (a * t) + x
          	else:
          		tmp = t_1
          	return tmp
          
          function code(x, y, z, t, a, b)
          	t_1 = Float64(x + Float64(Float64(a * z) * b))
          	tmp = 0.0
          	if (z <= -2.6e-32)
          		tmp = t_1;
          	elseif (z <= 1.3e-80)
          		tmp = Float64(Float64(a * t) + x);
          	else
          		tmp = t_1;
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z, t, a, b)
          	t_1 = x + ((a * z) * b);
          	tmp = 0.0;
          	if (z <= -2.6e-32)
          		tmp = t_1;
          	elseif (z <= 1.3e-80)
          		tmp = (a * t) + x;
          	else
          		tmp = t_1;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2374940160662717/91343852333181432387730302044767688728495783936], t$95$1, If[LessEqual[z, 3470978933371479/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072], N[(N[(a * t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
          
          \begin{array}{l}
          t_1 := x + \left(a \cdot z\right) \cdot b\\
          \mathbf{if}\;z \leq \frac{-2374940160662717}{91343852333181432387730302044767688728495783936}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;z \leq \frac{3470978933371479}{266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072}:\\
          \;\;\;\;a \cdot t + x\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_1\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if z < -2.5999999999999997e-32 or 1.3e-80 < z

            1. Initial program 92.8%

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

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

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

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

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

                \[\leadsto x + \left(a \cdot t + a \cdot \color{blue}{\left(b \cdot z\right)}\right) \]
              5. lower-*.f6471.4%

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

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

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

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

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

                \[\leadsto a \cdot t + a \cdot \left(b \cdot \color{blue}{z}\right) \]
              4. lower-*.f6448.4%

                \[\leadsto a \cdot t + a \cdot \left(b \cdot z\right) \]
            7. Applied rewrites48.4%

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

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

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

                \[\leadsto x + a \cdot \left(b \cdot \color{blue}{z}\right) \]
              3. lower-*.f6450.1%

                \[\leadsto x + a \cdot \left(b \cdot z\right) \]
            10. Applied rewrites50.1%

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

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

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

                \[\leadsto x + a \cdot \left(z \cdot b\right) \]
              4. associate-*l*N/A

                \[\leadsto x + \left(a \cdot z\right) \cdot b \]
              5. lift-*.f64N/A

                \[\leadsto x + \left(a \cdot z\right) \cdot b \]
              6. lift-*.f6451.3%

                \[\leadsto x + \left(a \cdot z\right) \cdot b \]
            12. Applied rewrites51.3%

              \[\leadsto x + \left(a \cdot z\right) \cdot b \]

            if -2.5999999999999997e-32 < z < 1.3e-80

            1. Initial program 92.8%

              \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
            2. Step-by-step derivation
              1. lift-+.f64N/A

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

                \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
              3. fp-cancel-sign-sub-invN/A

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

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

                \[\leadsto \left(\color{blue}{\left(x + y \cdot z\right)} + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
              6. associate-+l+N/A

                \[\leadsto \color{blue}{\left(x + \left(y \cdot z + t \cdot a\right)\right)} - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
              7. associate--l+N/A

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

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

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

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

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

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

                \[\leadsto a \cdot \left(t + \color{blue}{b \cdot z}\right) + x \]
              3. lower-*.f6473.7%

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

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

              \[\leadsto a \cdot t + x \]
            8. Step-by-step derivation
              1. Applied rewrites50.8%

                \[\leadsto a \cdot t + x \]
            9. Recombined 2 regimes into one program.
            10. Add Preprocessing

            Alternative 9: 61.0% accurate, 1.2× speedup?

            \[\begin{array}{l} t_1 := x + a \cdot \left(b \cdot z\right)\\ \mathbf{if}\;z \leq \frac{-2374940160662717}{91343852333181432387730302044767688728495783936}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq \frac{3470978933371479}{266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072}:\\ \;\;\;\;a \cdot t + x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
            (FPCore (x y z t a b)
              :precision binary64
              (let* ((t_1 (+ x (* a (* b z)))))
              (if (<=
                   z
                   -2374940160662717/91343852333181432387730302044767688728495783936)
                t_1
                (if (<=
                     z
                     3470978933371479/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072)
                  (+ (* a t) x)
                  t_1))))
            double code(double x, double y, double z, double t, double a, double b) {
            	double t_1 = x + (a * (b * z));
            	double tmp;
            	if (z <= -2.6e-32) {
            		tmp = t_1;
            	} else if (z <= 1.3e-80) {
            		tmp = (a * t) + x;
            	} else {
            		tmp = t_1;
            	}
            	return tmp;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y, z, t, a, b)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8), intent (in) :: t
                real(8), intent (in) :: a
                real(8), intent (in) :: b
                real(8) :: t_1
                real(8) :: tmp
                t_1 = x + (a * (b * z))
                if (z <= (-2.6d-32)) then
                    tmp = t_1
                else if (z <= 1.3d-80) then
                    tmp = (a * t) + x
                else
                    tmp = t_1
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z, double t, double a, double b) {
            	double t_1 = x + (a * (b * z));
            	double tmp;
            	if (z <= -2.6e-32) {
            		tmp = t_1;
            	} else if (z <= 1.3e-80) {
            		tmp = (a * t) + x;
            	} else {
            		tmp = t_1;
            	}
            	return tmp;
            }
            
            def code(x, y, z, t, a, b):
            	t_1 = x + (a * (b * z))
            	tmp = 0
            	if z <= -2.6e-32:
            		tmp = t_1
            	elif z <= 1.3e-80:
            		tmp = (a * t) + x
            	else:
            		tmp = t_1
            	return tmp
            
            function code(x, y, z, t, a, b)
            	t_1 = Float64(x + Float64(a * Float64(b * z)))
            	tmp = 0.0
            	if (z <= -2.6e-32)
            		tmp = t_1;
            	elseif (z <= 1.3e-80)
            		tmp = Float64(Float64(a * t) + x);
            	else
            		tmp = t_1;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z, t, a, b)
            	t_1 = x + (a * (b * z));
            	tmp = 0.0;
            	if (z <= -2.6e-32)
            		tmp = t_1;
            	elseif (z <= 1.3e-80)
            		tmp = (a * t) + x;
            	else
            		tmp = t_1;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(a * N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2374940160662717/91343852333181432387730302044767688728495783936], t$95$1, If[LessEqual[z, 3470978933371479/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072], N[(N[(a * t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
            
            \begin{array}{l}
            t_1 := x + a \cdot \left(b \cdot z\right)\\
            \mathbf{if}\;z \leq \frac{-2374940160662717}{91343852333181432387730302044767688728495783936}:\\
            \;\;\;\;t\_1\\
            
            \mathbf{elif}\;z \leq \frac{3470978933371479}{266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072}:\\
            \;\;\;\;a \cdot t + x\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_1\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if z < -2.5999999999999997e-32 or 1.3e-80 < z

              1. Initial program 92.8%

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

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

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

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

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

                  \[\leadsto x + \left(a \cdot t + a \cdot \color{blue}{\left(b \cdot z\right)}\right) \]
                5. lower-*.f6471.4%

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

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

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

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

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

                  \[\leadsto a \cdot t + a \cdot \left(b \cdot \color{blue}{z}\right) \]
                4. lower-*.f6448.4%

                  \[\leadsto a \cdot t + a \cdot \left(b \cdot z\right) \]
              7. Applied rewrites48.4%

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

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

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

                  \[\leadsto x + a \cdot \left(b \cdot \color{blue}{z}\right) \]
                3. lower-*.f6450.1%

                  \[\leadsto x + a \cdot \left(b \cdot z\right) \]
              10. Applied rewrites50.1%

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

              if -2.5999999999999997e-32 < z < 1.3e-80

              1. Initial program 92.8%

                \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
              2. Step-by-step derivation
                1. lift-+.f64N/A

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

                  \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
                3. fp-cancel-sign-sub-invN/A

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

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

                  \[\leadsto \left(\color{blue}{\left(x + y \cdot z\right)} + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
                6. associate-+l+N/A

                  \[\leadsto \color{blue}{\left(x + \left(y \cdot z + t \cdot a\right)\right)} - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
                7. associate--l+N/A

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

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

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

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

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

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

                  \[\leadsto a \cdot \left(t + \color{blue}{b \cdot z}\right) + x \]
                3. lower-*.f6473.7%

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

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

                \[\leadsto a \cdot t + x \]
              8. Step-by-step derivation
                1. Applied rewrites50.8%

                  \[\leadsto a \cdot t + x \]
              9. Recombined 2 regimes into one program.
              10. Add Preprocessing

              Alternative 10: 56.4% accurate, 1.3× speedup?

              \[\begin{array}{l} \mathbf{if}\;z \leq \frac{-2374940160662717}{91343852333181432387730302044767688728495783936}:\\ \;\;\;\;a \cdot \left(b \cdot z\right)\\ \mathbf{elif}\;z \leq 519999999999999967972319583654650286587951527928992692472643584:\\ \;\;\;\;a \cdot t + x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(a \cdot b\right)\\ \end{array} \]
              (FPCore (x y z t a b)
                :precision binary64
                (if (<=
                   z
                   -2374940160662717/91343852333181432387730302044767688728495783936)
                (* a (* b z))
                (if (<=
                     z
                     519999999999999967972319583654650286587951527928992692472643584)
                  (+ (* a t) x)
                  (* z (* a b)))))
              double code(double x, double y, double z, double t, double a, double b) {
              	double tmp;
              	if (z <= -2.6e-32) {
              		tmp = a * (b * z);
              	} else if (z <= 5.2e+62) {
              		tmp = (a * t) + x;
              	} else {
              		tmp = z * (a * b);
              	}
              	return tmp;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(x, y, z, t, a, b)
              use fmin_fmax_functions
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8), intent (in) :: z
                  real(8), intent (in) :: t
                  real(8), intent (in) :: a
                  real(8), intent (in) :: b
                  real(8) :: tmp
                  if (z <= (-2.6d-32)) then
                      tmp = a * (b * z)
                  else if (z <= 5.2d+62) then
                      tmp = (a * t) + x
                  else
                      tmp = z * (a * b)
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z, double t, double a, double b) {
              	double tmp;
              	if (z <= -2.6e-32) {
              		tmp = a * (b * z);
              	} else if (z <= 5.2e+62) {
              		tmp = (a * t) + x;
              	} else {
              		tmp = z * (a * b);
              	}
              	return tmp;
              }
              
              def code(x, y, z, t, a, b):
              	tmp = 0
              	if z <= -2.6e-32:
              		tmp = a * (b * z)
              	elif z <= 5.2e+62:
              		tmp = (a * t) + x
              	else:
              		tmp = z * (a * b)
              	return tmp
              
              function code(x, y, z, t, a, b)
              	tmp = 0.0
              	if (z <= -2.6e-32)
              		tmp = Float64(a * Float64(b * z));
              	elseif (z <= 5.2e+62)
              		tmp = Float64(Float64(a * t) + x);
              	else
              		tmp = Float64(z * Float64(a * b));
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z, t, a, b)
              	tmp = 0.0;
              	if (z <= -2.6e-32)
              		tmp = a * (b * z);
              	elseif (z <= 5.2e+62)
              		tmp = (a * t) + x;
              	else
              		tmp = z * (a * b);
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2374940160662717/91343852333181432387730302044767688728495783936], N[(a * N[(b * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 519999999999999967972319583654650286587951527928992692472643584], N[(N[(a * t), $MachinePrecision] + x), $MachinePrecision], N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision]]]
              
              \begin{array}{l}
              \mathbf{if}\;z \leq \frac{-2374940160662717}{91343852333181432387730302044767688728495783936}:\\
              \;\;\;\;a \cdot \left(b \cdot z\right)\\
              
              \mathbf{elif}\;z \leq 519999999999999967972319583654650286587951527928992692472643584:\\
              \;\;\;\;a \cdot t + x\\
              
              \mathbf{else}:\\
              \;\;\;\;z \cdot \left(a \cdot b\right)\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if z < -2.5999999999999997e-32

                1. Initial program 92.8%

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

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

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

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

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

                    \[\leadsto x + \left(a \cdot t + a \cdot \color{blue}{\left(b \cdot z\right)}\right) \]
                  5. lower-*.f6471.4%

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

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

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

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

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

                    \[\leadsto a \cdot t + a \cdot \left(b \cdot \color{blue}{z}\right) \]
                  4. lower-*.f6448.4%

                    \[\leadsto a \cdot t + a \cdot \left(b \cdot z\right) \]
                7. Applied rewrites48.4%

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

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

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

                    \[\leadsto x + a \cdot \left(b \cdot \color{blue}{z}\right) \]
                  3. lower-*.f6450.1%

                    \[\leadsto x + a \cdot \left(b \cdot z\right) \]
                10. Applied rewrites50.1%

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

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

                    \[\leadsto a \cdot \left(b \cdot z\right) \]
                  2. lower-*.f6427.4%

                    \[\leadsto a \cdot \left(b \cdot z\right) \]
                13. Applied rewrites27.4%

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

                if -2.5999999999999997e-32 < z < 5.1999999999999997e62

                1. Initial program 92.8%

                  \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
                2. Step-by-step derivation
                  1. lift-+.f64N/A

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

                    \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
                  3. fp-cancel-sign-sub-invN/A

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

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

                    \[\leadsto \left(\color{blue}{\left(x + y \cdot z\right)} + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
                  6. associate-+l+N/A

                    \[\leadsto \color{blue}{\left(x + \left(y \cdot z + t \cdot a\right)\right)} - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
                  7. associate--l+N/A

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

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

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

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

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

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

                    \[\leadsto a \cdot \left(t + \color{blue}{b \cdot z}\right) + x \]
                  3. lower-*.f6473.7%

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

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

                  \[\leadsto a \cdot t + x \]
                8. Step-by-step derivation
                  1. Applied rewrites50.8%

                    \[\leadsto a \cdot t + x \]

                  if 5.1999999999999997e62 < z

                  1. Initial program 92.8%

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

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

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

                      \[\leadsto z \cdot \left(y + \color{blue}{a \cdot b}\right) \]
                    3. lower-*.f6452.1%

                      \[\leadsto z \cdot \left(y + a \cdot \color{blue}{b}\right) \]
                  4. Applied rewrites52.1%

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

                    \[\leadsto z \cdot \left(a \cdot \color{blue}{b}\right) \]
                  6. Step-by-step derivation
                    1. lower-*.f6427.6%

                      \[\leadsto z \cdot \left(a \cdot b\right) \]
                  7. Applied rewrites27.6%

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

                Alternative 11: 55.9% accurate, 1.3× speedup?

                \[\begin{array}{l} t_1 := a \cdot \left(b \cdot z\right)\\ \mathbf{if}\;z \leq \frac{-2374940160662717}{91343852333181432387730302044767688728495783936}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 6400000000000000093636449476319187398208275122333792379383109037886696731207348581826560:\\ \;\;\;\;a \cdot t + x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
                (FPCore (x y z t a b)
                  :precision binary64
                  (let* ((t_1 (* a (* b z))))
                  (if (<=
                       z
                       -2374940160662717/91343852333181432387730302044767688728495783936)
                    t_1
                    (if (<=
                         z
                         6400000000000000093636449476319187398208275122333792379383109037886696731207348581826560)
                      (+ (* a t) x)
                      t_1))))
                double code(double x, double y, double z, double t, double a, double b) {
                	double t_1 = a * (b * z);
                	double tmp;
                	if (z <= -2.6e-32) {
                		tmp = t_1;
                	} else if (z <= 6.4e+87) {
                		tmp = (a * t) + x;
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(x, y, z, t, a, b)
                use fmin_fmax_functions
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    real(8), intent (in) :: t
                    real(8), intent (in) :: a
                    real(8), intent (in) :: b
                    real(8) :: t_1
                    real(8) :: tmp
                    t_1 = a * (b * z)
                    if (z <= (-2.6d-32)) then
                        tmp = t_1
                    else if (z <= 6.4d+87) then
                        tmp = (a * t) + x
                    else
                        tmp = t_1
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z, double t, double a, double b) {
                	double t_1 = a * (b * z);
                	double tmp;
                	if (z <= -2.6e-32) {
                		tmp = t_1;
                	} else if (z <= 6.4e+87) {
                		tmp = (a * t) + x;
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                def code(x, y, z, t, a, b):
                	t_1 = a * (b * z)
                	tmp = 0
                	if z <= -2.6e-32:
                		tmp = t_1
                	elif z <= 6.4e+87:
                		tmp = (a * t) + x
                	else:
                		tmp = t_1
                	return tmp
                
                function code(x, y, z, t, a, b)
                	t_1 = Float64(a * Float64(b * z))
                	tmp = 0.0
                	if (z <= -2.6e-32)
                		tmp = t_1;
                	elseif (z <= 6.4e+87)
                		tmp = Float64(Float64(a * t) + x);
                	else
                		tmp = t_1;
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z, t, a, b)
                	t_1 = a * (b * z);
                	tmp = 0.0;
                	if (z <= -2.6e-32)
                		tmp = t_1;
                	elseif (z <= 6.4e+87)
                		tmp = (a * t) + x;
                	else
                		tmp = t_1;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(b * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2374940160662717/91343852333181432387730302044767688728495783936], t$95$1, If[LessEqual[z, 6400000000000000093636449476319187398208275122333792379383109037886696731207348581826560], N[(N[(a * t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
                
                \begin{array}{l}
                t_1 := a \cdot \left(b \cdot z\right)\\
                \mathbf{if}\;z \leq \frac{-2374940160662717}{91343852333181432387730302044767688728495783936}:\\
                \;\;\;\;t\_1\\
                
                \mathbf{elif}\;z \leq 6400000000000000093636449476319187398208275122333792379383109037886696731207348581826560:\\
                \;\;\;\;a \cdot t + x\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_1\\
                
                
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if z < -2.5999999999999997e-32 or 6.4000000000000001e87 < z

                  1. Initial program 92.8%

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

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

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

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

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

                      \[\leadsto x + \left(a \cdot t + a \cdot \color{blue}{\left(b \cdot z\right)}\right) \]
                    5. lower-*.f6471.4%

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

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

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

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

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

                      \[\leadsto a \cdot t + a \cdot \left(b \cdot \color{blue}{z}\right) \]
                    4. lower-*.f6448.4%

                      \[\leadsto a \cdot t + a \cdot \left(b \cdot z\right) \]
                  7. Applied rewrites48.4%

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

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

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

                      \[\leadsto x + a \cdot \left(b \cdot \color{blue}{z}\right) \]
                    3. lower-*.f6450.1%

                      \[\leadsto x + a \cdot \left(b \cdot z\right) \]
                  10. Applied rewrites50.1%

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

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

                      \[\leadsto a \cdot \left(b \cdot z\right) \]
                    2. lower-*.f6427.4%

                      \[\leadsto a \cdot \left(b \cdot z\right) \]
                  13. Applied rewrites27.4%

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

                  if -2.5999999999999997e-32 < z < 6.4000000000000001e87

                  1. Initial program 92.8%

                    \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
                  2. Step-by-step derivation
                    1. lift-+.f64N/A

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

                      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
                    3. fp-cancel-sign-sub-invN/A

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

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

                      \[\leadsto \left(\color{blue}{\left(x + y \cdot z\right)} + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
                    6. associate-+l+N/A

                      \[\leadsto \color{blue}{\left(x + \left(y \cdot z + t \cdot a\right)\right)} - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
                    7. associate--l+N/A

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

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

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

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

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

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

                      \[\leadsto a \cdot \left(t + \color{blue}{b \cdot z}\right) + x \]
                    3. lower-*.f6473.7%

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

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

                    \[\leadsto a \cdot t + x \]
                  8. Step-by-step derivation
                    1. Applied rewrites50.8%

                      \[\leadsto a \cdot t + x \]
                  9. Recombined 2 regimes into one program.
                  10. Add Preprocessing

                  Alternative 12: 50.8% accurate, 3.3× speedup?

                  \[a \cdot t + x \]
                  (FPCore (x y z t a b)
                    :precision binary64
                    (+ (* a t) x))
                  double code(double x, double y, double z, double t, double a, double b) {
                  	return (a * t) + x;
                  }
                  
                  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 * t) + x
                  end function
                  
                  public static double code(double x, double y, double z, double t, double a, double b) {
                  	return (a * t) + x;
                  }
                  
                  def code(x, y, z, t, a, b):
                  	return (a * t) + x
                  
                  function code(x, y, z, t, a, b)
                  	return Float64(Float64(a * t) + x)
                  end
                  
                  function tmp = code(x, y, z, t, a, b)
                  	tmp = (a * t) + x;
                  end
                  
                  code[x_, y_, z_, t_, a_, b_] := N[(N[(a * t), $MachinePrecision] + x), $MachinePrecision]
                  
                  a \cdot t + x
                  
                  Derivation
                  1. Initial program 92.8%

                    \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
                  2. Step-by-step derivation
                    1. lift-+.f64N/A

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

                      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot z\right) \cdot b} \]
                    3. fp-cancel-sign-sub-invN/A

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

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

                      \[\leadsto \left(\color{blue}{\left(x + y \cdot z\right)} + t \cdot a\right) - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
                    6. associate-+l+N/A

                      \[\leadsto \color{blue}{\left(x + \left(y \cdot z + t \cdot a\right)\right)} - \left(\mathsf{neg}\left(a \cdot z\right)\right) \cdot b \]
                    7. associate--l+N/A

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

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

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

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

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

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

                      \[\leadsto a \cdot \left(t + \color{blue}{b \cdot z}\right) + x \]
                    3. lower-*.f6473.7%

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

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

                    \[\leadsto a \cdot t + x \]
                  8. Step-by-step derivation
                    1. Applied rewrites50.8%

                      \[\leadsto a \cdot t + x \]
                    2. Add Preprocessing

                    Reproduce

                    ?
                    herbie shell --seed 2025271 -o generate:evaluate
                    (FPCore (x y z t a b)
                      :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
                      :precision binary64
                      (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))