Data.Colour.Matrix:inverse from colour-2.3.3, B

Percentage Accurate: 91.5% → 97.0%
Time: 5.2s
Alternatives: 7
Speedup: 0.7×

Specification

?
\[\begin{array}{l} \\ \frac{x \cdot y - z \cdot t}{a} \end{array} \]
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
	return ((x * y) - (z * t)) / a;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

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

\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 7 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: 91.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x \cdot y - z \cdot t}{a} \end{array} \]
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
	return ((x * y) - (z * t)) / a;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

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

\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}

Alternative 1: 97.0% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := x \cdot y - z \cdot t\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+260} \lor \neg \left(t\_1 \leq 10^{+262}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{a}, y, \left(-t\right) \cdot \frac{z}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_1}{a}\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (* x y) (* z t))))
   (if (or (<= t_1 -5e+260) (not (<= t_1 1e+262)))
     (fma (/ x a) y (* (- t) (/ z a)))
     (/ t_1 a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x * y) - (z * t);
	double tmp;
	if ((t_1 <= -5e+260) || !(t_1 <= 1e+262)) {
		tmp = fma((x / a), y, (-t * (z / a)));
	} else {
		tmp = t_1 / a;
	}
	return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if ((t_1 <= -5e+260) || !(t_1 <= 1e+262))
		tmp = fma(Float64(x / a), y, Float64(Float64(-t) * Float64(z / a)));
	else
		tmp = Float64(t_1 / a);
	end
	return tmp
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+260], N[Not[LessEqual[t$95$1, 1e+262]], $MachinePrecision]], N[(N[(x / a), $MachinePrecision] * y + N[((-t) * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+260} \lor \neg \left(t\_1 \leq 10^{+262}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{a}, y, \left(-t\right) \cdot \frac{z}{a}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999996e260 or 1e262 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 67.1%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot t}{a}} \]
      2. lift--.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y - z \cdot t}}{a} \]
      3. div-subN/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{z \cdot t}}{a} \]
      5. *-commutativeN/A

        \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{t \cdot z}}{a} \]
      6. associate-/l*N/A

        \[\leadsto \frac{x \cdot y}{a} - \color{blue}{t \cdot \frac{z}{a}} \]
      7. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \color{blue}{\left(-t\right)} \cdot \frac{z}{a}\right) \]
      16. lower-/.f6494.7

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

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

    if -4.9999999999999996e260 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e262

    1. Initial program 98.6%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification97.4%

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

Alternative 2: 96.6% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := x \cdot y - z \cdot t\\ \mathbf{if}\;t\_1 \leq -4 \cdot 10^{+272} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+291}\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{-t}{y}, z, x\right)}{a} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_1}{a}\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (* x y) (* z t))))
   (if (or (<= t_1 -4e+272) (not (<= t_1 2e+291)))
     (* (/ (fma (/ (- t) y) z x) a) y)
     (/ t_1 a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x * y) - (z * t);
	double tmp;
	if ((t_1 <= -4e+272) || !(t_1 <= 2e+291)) {
		tmp = (fma((-t / y), z, x) / a) * y;
	} else {
		tmp = t_1 / a;
	}
	return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if ((t_1 <= -4e+272) || !(t_1 <= 2e+291))
		tmp = Float64(Float64(fma(Float64(Float64(-t) / y), z, x) / a) * y);
	else
		tmp = Float64(t_1 / a);
	end
	return tmp
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -4e+272], N[Not[LessEqual[t$95$1, 2e+291]], $MachinePrecision]], N[(N[(N[(N[((-t) / y), $MachinePrecision] * z + x), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+272} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+291}\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-t}{y}, z, x\right)}{a} \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 x y) (*.f64 z t)) < -4.0000000000000003e272 or 1.9999999999999999e291 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 59.3%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot t}{a}} \]
      2. lift--.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y - z \cdot t}}{a} \]
      3. div-subN/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{z \cdot t}}{a} \]
      5. *-commutativeN/A

        \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{t \cdot z}}{a} \]
      6. associate-/l*N/A

        \[\leadsto \frac{x \cdot y}{a} - \color{blue}{t \cdot \frac{z}{a}} \]
      7. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \color{blue}{\left(-t\right)} \cdot \frac{z}{a}\right) \]
      16. lower-/.f6495.1

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

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

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

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

      if -4.0000000000000003e272 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.9999999999999999e291

      1. Initial program 98.7%

        \[\frac{x \cdot y - z \cdot t}{a} \]
      2. Add Preprocessing
    7. Recombined 2 regimes into one program.
    8. Final simplification95.7%

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

    Alternative 3: 71.7% accurate, 0.4× speedup?

    \[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := \frac{-z}{a} \cdot t\\ \mathbf{if}\;z \cdot t \leq -3 \cdot 10^{+21}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-70}:\\ \;\;\;\;\frac{y \cdot x}{a}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-91} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{-39}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a} \cdot y\\ \end{array} \end{array} \]
    NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
    (FPCore (x y z t a)
     :precision binary64
     (let* ((t_1 (* (/ (- z) a) t)))
       (if (<= (* z t) -3e+21)
         t_1
         (if (<= (* z t) -5e-70)
           (/ (* y x) a)
           (if (or (<= (* z t) -5e-91) (not (<= (* z t) 2e-39)))
             t_1
             (* (/ x a) y))))))
    assert(x < y && y < z && z < t && t < a);
    double code(double x, double y, double z, double t, double a) {
    	double t_1 = (-z / a) * t;
    	double tmp;
    	if ((z * t) <= -3e+21) {
    		tmp = t_1;
    	} else if ((z * t) <= -5e-70) {
    		tmp = (y * x) / a;
    	} else if (((z * t) <= -5e-91) || !((z * t) <= 2e-39)) {
    		tmp = t_1;
    	} else {
    		tmp = (x / a) * y;
    	}
    	return tmp;
    }
    
    NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
    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)
    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) :: t_1
        real(8) :: tmp
        t_1 = (-z / a) * t
        if ((z * t) <= (-3d+21)) then
            tmp = t_1
        else if ((z * t) <= (-5d-70)) then
            tmp = (y * x) / a
        else if (((z * t) <= (-5d-91)) .or. (.not. ((z * t) <= 2d-39))) then
            tmp = t_1
        else
            tmp = (x / a) * y
        end if
        code = tmp
    end function
    
    assert x < y && y < z && z < t && t < a;
    public static double code(double x, double y, double z, double t, double a) {
    	double t_1 = (-z / a) * t;
    	double tmp;
    	if ((z * t) <= -3e+21) {
    		tmp = t_1;
    	} else if ((z * t) <= -5e-70) {
    		tmp = (y * x) / a;
    	} else if (((z * t) <= -5e-91) || !((z * t) <= 2e-39)) {
    		tmp = t_1;
    	} else {
    		tmp = (x / a) * y;
    	}
    	return tmp;
    }
    
    [x, y, z, t, a] = sort([x, y, z, t, a])
    def code(x, y, z, t, a):
    	t_1 = (-z / a) * t
    	tmp = 0
    	if (z * t) <= -3e+21:
    		tmp = t_1
    	elif (z * t) <= -5e-70:
    		tmp = (y * x) / a
    	elif ((z * t) <= -5e-91) or not ((z * t) <= 2e-39):
    		tmp = t_1
    	else:
    		tmp = (x / a) * y
    	return tmp
    
    x, y, z, t, a = sort([x, y, z, t, a])
    function code(x, y, z, t, a)
    	t_1 = Float64(Float64(Float64(-z) / a) * t)
    	tmp = 0.0
    	if (Float64(z * t) <= -3e+21)
    		tmp = t_1;
    	elseif (Float64(z * t) <= -5e-70)
    		tmp = Float64(Float64(y * x) / a);
    	elseif ((Float64(z * t) <= -5e-91) || !(Float64(z * t) <= 2e-39))
    		tmp = t_1;
    	else
    		tmp = Float64(Float64(x / a) * y);
    	end
    	return tmp
    end
    
    x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
    function tmp_2 = code(x, y, z, t, a)
    	t_1 = (-z / a) * t;
    	tmp = 0.0;
    	if ((z * t) <= -3e+21)
    		tmp = t_1;
    	elseif ((z * t) <= -5e-70)
    		tmp = (y * x) / a;
    	elseif (((z * t) <= -5e-91) || ~(((z * t) <= 2e-39)))
    		tmp = t_1;
    	else
    		tmp = (x / a) * y;
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
    code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[((-z) / a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -3e+21], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -5e-70], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], If[Or[LessEqual[N[(z * t), $MachinePrecision], -5e-91], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e-39]], $MachinePrecision]], t$95$1, N[(N[(x / a), $MachinePrecision] * y), $MachinePrecision]]]]]
    
    \begin{array}{l}
    [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
    \\
    \begin{array}{l}
    t_1 := \frac{-z}{a} \cdot t\\
    \mathbf{if}\;z \cdot t \leq -3 \cdot 10^{+21}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-70}:\\
    \;\;\;\;\frac{y \cdot x}{a}\\
    
    \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-91} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{-39}\right):\\
    \;\;\;\;t\_1\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{x}{a} \cdot y\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if (*.f64 z t) < -3e21 or -4.9999999999999998e-70 < (*.f64 z t) < -4.99999999999999997e-91 or 1.99999999999999986e-39 < (*.f64 z t)

      1. Initial program 86.3%

        \[\frac{x \cdot y - z \cdot t}{a} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot t}{a}} \]
        2. lift--.f64N/A

          \[\leadsto \frac{\color{blue}{x \cdot y - z \cdot t}}{a} \]
        3. div-subN/A

          \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
        4. lift-*.f64N/A

          \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{z \cdot t}}{a} \]
        5. *-commutativeN/A

          \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{t \cdot z}}{a} \]
        6. associate-/l*N/A

          \[\leadsto \frac{x \cdot y}{a} - \color{blue}{t \cdot \frac{z}{a}} \]
        7. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \color{blue}{\left(-t\right)} \cdot \frac{z}{a}\right) \]
        16. lower-/.f6492.2

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
      6. Applied rewrites80.8%

        \[\leadsto \color{blue}{\frac{-z}{a} \cdot t} \]

      if -3e21 < (*.f64 z t) < -4.9999999999999998e-70

      1. Initial program 99.8%

        \[\frac{x \cdot y - z \cdot t}{a} \]
      2. Add Preprocessing
      3. Taylor expanded in x around inf

        \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
      4. Step-by-step derivation
        1. Applied rewrites74.7%

          \[\leadsto \frac{\color{blue}{y \cdot x}}{a} \]

        if -4.99999999999999997e-91 < (*.f64 z t) < 1.99999999999999986e-39

        1. Initial program 91.1%

          \[\frac{x \cdot y - z \cdot t}{a} \]
        2. Add Preprocessing
        3. Taylor expanded in x around inf

          \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
        4. Step-by-step derivation
          1. Applied rewrites81.6%

            \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
        5. Recombined 3 regimes into one program.
        6. Final simplification80.7%

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -3 \cdot 10^{+21}:\\ \;\;\;\;\frac{-z}{a} \cdot t\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-70}:\\ \;\;\;\;\frac{y \cdot x}{a}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-91} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{-39}\right):\\ \;\;\;\;\frac{-z}{a} \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a} \cdot y\\ \end{array} \]
        7. Add Preprocessing

        Alternative 4: 71.5% accurate, 0.4× speedup?

        \[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := \left(-z\right) \cdot \frac{t}{a}\\ \mathbf{if}\;z \cdot t \leq -3 \cdot 10^{+21}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-70}:\\ \;\;\;\;\frac{y \cdot x}{a}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-91}:\\ \;\;\;\;\frac{\left(-z\right) \cdot t}{a}\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-39}:\\ \;\;\;\;\frac{x}{a} \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
        (FPCore (x y z t a)
         :precision binary64
         (let* ((t_1 (* (- z) (/ t a))))
           (if (<= (* z t) -3e+21)
             t_1
             (if (<= (* z t) -5e-70)
               (/ (* y x) a)
               (if (<= (* z t) -5e-91)
                 (/ (* (- z) t) a)
                 (if (<= (* z t) 2e-39) (* (/ x a) y) t_1))))))
        assert(x < y && y < z && z < t && t < a);
        double code(double x, double y, double z, double t, double a) {
        	double t_1 = -z * (t / a);
        	double tmp;
        	if ((z * t) <= -3e+21) {
        		tmp = t_1;
        	} else if ((z * t) <= -5e-70) {
        		tmp = (y * x) / a;
        	} else if ((z * t) <= -5e-91) {
        		tmp = (-z * t) / a;
        	} else if ((z * t) <= 2e-39) {
        		tmp = (x / a) * y;
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
        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)
        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) :: t_1
            real(8) :: tmp
            t_1 = -z * (t / a)
            if ((z * t) <= (-3d+21)) then
                tmp = t_1
            else if ((z * t) <= (-5d-70)) then
                tmp = (y * x) / a
            else if ((z * t) <= (-5d-91)) then
                tmp = (-z * t) / a
            else if ((z * t) <= 2d-39) then
                tmp = (x / a) * y
            else
                tmp = t_1
            end if
            code = tmp
        end function
        
        assert x < y && y < z && z < t && t < a;
        public static double code(double x, double y, double z, double t, double a) {
        	double t_1 = -z * (t / a);
        	double tmp;
        	if ((z * t) <= -3e+21) {
        		tmp = t_1;
        	} else if ((z * t) <= -5e-70) {
        		tmp = (y * x) / a;
        	} else if ((z * t) <= -5e-91) {
        		tmp = (-z * t) / a;
        	} else if ((z * t) <= 2e-39) {
        		tmp = (x / a) * y;
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        [x, y, z, t, a] = sort([x, y, z, t, a])
        def code(x, y, z, t, a):
        	t_1 = -z * (t / a)
        	tmp = 0
        	if (z * t) <= -3e+21:
        		tmp = t_1
        	elif (z * t) <= -5e-70:
        		tmp = (y * x) / a
        	elif (z * t) <= -5e-91:
        		tmp = (-z * t) / a
        	elif (z * t) <= 2e-39:
        		tmp = (x / a) * y
        	else:
        		tmp = t_1
        	return tmp
        
        x, y, z, t, a = sort([x, y, z, t, a])
        function code(x, y, z, t, a)
        	t_1 = Float64(Float64(-z) * Float64(t / a))
        	tmp = 0.0
        	if (Float64(z * t) <= -3e+21)
        		tmp = t_1;
        	elseif (Float64(z * t) <= -5e-70)
        		tmp = Float64(Float64(y * x) / a);
        	elseif (Float64(z * t) <= -5e-91)
        		tmp = Float64(Float64(Float64(-z) * t) / a);
        	elseif (Float64(z * t) <= 2e-39)
        		tmp = Float64(Float64(x / a) * y);
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
        function tmp_2 = code(x, y, z, t, a)
        	t_1 = -z * (t / a);
        	tmp = 0.0;
        	if ((z * t) <= -3e+21)
        		tmp = t_1;
        	elseif ((z * t) <= -5e-70)
        		tmp = (y * x) / a;
        	elseif ((z * t) <= -5e-91)
        		tmp = (-z * t) / a;
        	elseif ((z * t) <= 2e-39)
        		tmp = (x / a) * y;
        	else
        		tmp = t_1;
        	end
        	tmp_2 = tmp;
        end
        
        NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
        code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-z) * N[(t / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -3e+21], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -5e-70], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -5e-91], N[(N[((-z) * t), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e-39], N[(N[(x / a), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]]
        
        \begin{array}{l}
        [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
        \\
        \begin{array}{l}
        t_1 := \left(-z\right) \cdot \frac{t}{a}\\
        \mathbf{if}\;z \cdot t \leq -3 \cdot 10^{+21}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-70}:\\
        \;\;\;\;\frac{y \cdot x}{a}\\
        
        \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-91}:\\
        \;\;\;\;\frac{\left(-z\right) \cdot t}{a}\\
        
        \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-39}:\\
        \;\;\;\;\frac{x}{a} \cdot y\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 4 regimes
        2. if (*.f64 z t) < -3e21 or 1.99999999999999986e-39 < (*.f64 z t)

          1. Initial program 85.6%

            \[\frac{x \cdot y - z \cdot t}{a} \]
          2. Add Preprocessing
          3. Taylor expanded in x around 0

            \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
          4. Step-by-step derivation
            1. Applied rewrites78.1%

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

            if -3e21 < (*.f64 z t) < -4.9999999999999998e-70

            1. Initial program 99.8%

              \[\frac{x \cdot y - z \cdot t}{a} \]
            2. Add Preprocessing
            3. Taylor expanded in x around inf

              \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
            4. Step-by-step derivation
              1. Applied rewrites74.7%

                \[\leadsto \frac{\color{blue}{y \cdot x}}{a} \]

              if -4.9999999999999998e-70 < (*.f64 z t) < -4.99999999999999997e-91

              1. Initial program 99.6%

                \[\frac{x \cdot y - z \cdot t}{a} \]
              2. Add Preprocessing
              3. Taylor expanded in x around 0

                \[\leadsto \frac{\color{blue}{-1 \cdot \left(t \cdot z\right)}}{a} \]
              4. Step-by-step derivation
                1. Applied rewrites99.6%

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

                if -4.99999999999999997e-91 < (*.f64 z t) < 1.99999999999999986e-39

                1. Initial program 91.1%

                  \[\frac{x \cdot y - z \cdot t}{a} \]
                2. Add Preprocessing
                3. Taylor expanded in x around inf

                  \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
                4. Step-by-step derivation
                  1. Applied rewrites81.6%

                    \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
                5. Recombined 4 regimes into one program.
                6. Final simplification79.8%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -3 \cdot 10^{+21}:\\ \;\;\;\;\left(-z\right) \cdot \frac{t}{a}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-70}:\\ \;\;\;\;\frac{y \cdot x}{a}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-91}:\\ \;\;\;\;\frac{\left(-z\right) \cdot t}{a}\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-39}:\\ \;\;\;\;\frac{x}{a} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) \cdot \frac{t}{a}\\ \end{array} \]
                7. Add Preprocessing

                Alternative 5: 71.4% accurate, 0.4× speedup?

                \[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := \left(-z\right) \cdot \frac{t}{a}\\ \mathbf{if}\;z \cdot t \leq -3 \cdot 10^{+21}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-70}:\\ \;\;\;\;\frac{y \cdot x}{a}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-91}:\\ \;\;\;\;\frac{-z}{a} \cdot t\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-39}:\\ \;\;\;\;\frac{x}{a} \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
                (FPCore (x y z t a)
                 :precision binary64
                 (let* ((t_1 (* (- z) (/ t a))))
                   (if (<= (* z t) -3e+21)
                     t_1
                     (if (<= (* z t) -5e-70)
                       (/ (* y x) a)
                       (if (<= (* z t) -5e-91)
                         (* (/ (- z) a) t)
                         (if (<= (* z t) 2e-39) (* (/ x a) y) t_1))))))
                assert(x < y && y < z && z < t && t < a);
                double code(double x, double y, double z, double t, double a) {
                	double t_1 = -z * (t / a);
                	double tmp;
                	if ((z * t) <= -3e+21) {
                		tmp = t_1;
                	} else if ((z * t) <= -5e-70) {
                		tmp = (y * x) / a;
                	} else if ((z * t) <= -5e-91) {
                		tmp = (-z / a) * t;
                	} else if ((z * t) <= 2e-39) {
                		tmp = (x / a) * y;
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
                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)
                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) :: t_1
                    real(8) :: tmp
                    t_1 = -z * (t / a)
                    if ((z * t) <= (-3d+21)) then
                        tmp = t_1
                    else if ((z * t) <= (-5d-70)) then
                        tmp = (y * x) / a
                    else if ((z * t) <= (-5d-91)) then
                        tmp = (-z / a) * t
                    else if ((z * t) <= 2d-39) then
                        tmp = (x / a) * y
                    else
                        tmp = t_1
                    end if
                    code = tmp
                end function
                
                assert x < y && y < z && z < t && t < a;
                public static double code(double x, double y, double z, double t, double a) {
                	double t_1 = -z * (t / a);
                	double tmp;
                	if ((z * t) <= -3e+21) {
                		tmp = t_1;
                	} else if ((z * t) <= -5e-70) {
                		tmp = (y * x) / a;
                	} else if ((z * t) <= -5e-91) {
                		tmp = (-z / a) * t;
                	} else if ((z * t) <= 2e-39) {
                		tmp = (x / a) * y;
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                [x, y, z, t, a] = sort([x, y, z, t, a])
                def code(x, y, z, t, a):
                	t_1 = -z * (t / a)
                	tmp = 0
                	if (z * t) <= -3e+21:
                		tmp = t_1
                	elif (z * t) <= -5e-70:
                		tmp = (y * x) / a
                	elif (z * t) <= -5e-91:
                		tmp = (-z / a) * t
                	elif (z * t) <= 2e-39:
                		tmp = (x / a) * y
                	else:
                		tmp = t_1
                	return tmp
                
                x, y, z, t, a = sort([x, y, z, t, a])
                function code(x, y, z, t, a)
                	t_1 = Float64(Float64(-z) * Float64(t / a))
                	tmp = 0.0
                	if (Float64(z * t) <= -3e+21)
                		tmp = t_1;
                	elseif (Float64(z * t) <= -5e-70)
                		tmp = Float64(Float64(y * x) / a);
                	elseif (Float64(z * t) <= -5e-91)
                		tmp = Float64(Float64(Float64(-z) / a) * t);
                	elseif (Float64(z * t) <= 2e-39)
                		tmp = Float64(Float64(x / a) * y);
                	else
                		tmp = t_1;
                	end
                	return tmp
                end
                
                x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
                function tmp_2 = code(x, y, z, t, a)
                	t_1 = -z * (t / a);
                	tmp = 0.0;
                	if ((z * t) <= -3e+21)
                		tmp = t_1;
                	elseif ((z * t) <= -5e-70)
                		tmp = (y * x) / a;
                	elseif ((z * t) <= -5e-91)
                		tmp = (-z / a) * t;
                	elseif ((z * t) <= 2e-39)
                		tmp = (x / a) * y;
                	else
                		tmp = t_1;
                	end
                	tmp_2 = tmp;
                end
                
                NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
                code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-z) * N[(t / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -3e+21], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -5e-70], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -5e-91], N[(N[((-z) / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e-39], N[(N[(x / a), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]]
                
                \begin{array}{l}
                [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
                \\
                \begin{array}{l}
                t_1 := \left(-z\right) \cdot \frac{t}{a}\\
                \mathbf{if}\;z \cdot t \leq -3 \cdot 10^{+21}:\\
                \;\;\;\;t\_1\\
                
                \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-70}:\\
                \;\;\;\;\frac{y \cdot x}{a}\\
                
                \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-91}:\\
                \;\;\;\;\frac{-z}{a} \cdot t\\
                
                \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-39}:\\
                \;\;\;\;\frac{x}{a} \cdot y\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_1\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 4 regimes
                2. if (*.f64 z t) < -3e21 or 1.99999999999999986e-39 < (*.f64 z t)

                  1. Initial program 85.6%

                    \[\frac{x \cdot y - z \cdot t}{a} \]
                  2. Add Preprocessing
                  3. Taylor expanded in x around 0

                    \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
                  4. Step-by-step derivation
                    1. Applied rewrites78.1%

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

                    if -3e21 < (*.f64 z t) < -4.9999999999999998e-70

                    1. Initial program 99.8%

                      \[\frac{x \cdot y - z \cdot t}{a} \]
                    2. Add Preprocessing
                    3. Taylor expanded in x around inf

                      \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
                    4. Step-by-step derivation
                      1. Applied rewrites74.7%

                        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} \]

                      if -4.9999999999999998e-70 < (*.f64 z t) < -4.99999999999999997e-91

                      1. Initial program 99.6%

                        \[\frac{x \cdot y - z \cdot t}{a} \]
                      2. Add Preprocessing
                      3. Step-by-step derivation
                        1. lift-/.f64N/A

                          \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot t}{a}} \]
                        2. lift--.f64N/A

                          \[\leadsto \frac{\color{blue}{x \cdot y - z \cdot t}}{a} \]
                        3. div-subN/A

                          \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
                        4. lift-*.f64N/A

                          \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{z \cdot t}}{a} \]
                        5. *-commutativeN/A

                          \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{t \cdot z}}{a} \]
                        6. associate-/l*N/A

                          \[\leadsto \frac{x \cdot y}{a} - \color{blue}{t \cdot \frac{z}{a}} \]
                        7. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \color{blue}{\left(-t\right)} \cdot \frac{z}{a}\right) \]
                        16. lower-/.f6486.1

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

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

                        \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
                      6. Applied rewrites86.1%

                        \[\leadsto \color{blue}{\frac{-z}{a} \cdot t} \]

                      if -4.99999999999999997e-91 < (*.f64 z t) < 1.99999999999999986e-39

                      1. Initial program 91.1%

                        \[\frac{x \cdot y - z \cdot t}{a} \]
                      2. Add Preprocessing
                      3. Taylor expanded in x around inf

                        \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
                      4. Step-by-step derivation
                        1. Applied rewrites81.6%

                          \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
                      5. Recombined 4 regimes into one program.
                      6. Final simplification79.4%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -3 \cdot 10^{+21}:\\ \;\;\;\;\left(-z\right) \cdot \frac{t}{a}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-70}:\\ \;\;\;\;\frac{y \cdot x}{a}\\ \mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-91}:\\ \;\;\;\;\frac{-z}{a} \cdot t\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-39}:\\ \;\;\;\;\frac{x}{a} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) \cdot \frac{t}{a}\\ \end{array} \]
                      7. Add Preprocessing

                      Alternative 6: 93.1% accurate, 0.7× speedup?

                      \[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq 5 \cdot 10^{+287}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-z}{a} \cdot t\\ \end{array} \end{array} \]
                      NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
                      (FPCore (x y z t a)
                       :precision binary64
                       (if (<= (* z t) 5e+287) (/ (- (* x y) (* z t)) a) (* (/ (- z) a) t)))
                      assert(x < y && y < z && z < t && t < a);
                      double code(double x, double y, double z, double t, double a) {
                      	double tmp;
                      	if ((z * t) <= 5e+287) {
                      		tmp = ((x * y) - (z * t)) / a;
                      	} else {
                      		tmp = (-z / a) * t;
                      	}
                      	return tmp;
                      }
                      
                      NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
                      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)
                      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) :: tmp
                          if ((z * t) <= 5d+287) then
                              tmp = ((x * y) - (z * t)) / a
                          else
                              tmp = (-z / a) * t
                          end if
                          code = tmp
                      end function
                      
                      assert x < y && y < z && z < t && t < a;
                      public static double code(double x, double y, double z, double t, double a) {
                      	double tmp;
                      	if ((z * t) <= 5e+287) {
                      		tmp = ((x * y) - (z * t)) / a;
                      	} else {
                      		tmp = (-z / a) * t;
                      	}
                      	return tmp;
                      }
                      
                      [x, y, z, t, a] = sort([x, y, z, t, a])
                      def code(x, y, z, t, a):
                      	tmp = 0
                      	if (z * t) <= 5e+287:
                      		tmp = ((x * y) - (z * t)) / a
                      	else:
                      		tmp = (-z / a) * t
                      	return tmp
                      
                      x, y, z, t, a = sort([x, y, z, t, a])
                      function code(x, y, z, t, a)
                      	tmp = 0.0
                      	if (Float64(z * t) <= 5e+287)
                      		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a);
                      	else
                      		tmp = Float64(Float64(Float64(-z) / a) * t);
                      	end
                      	return tmp
                      end
                      
                      x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
                      function tmp_2 = code(x, y, z, t, a)
                      	tmp = 0.0;
                      	if ((z * t) <= 5e+287)
                      		tmp = ((x * y) - (z * t)) / a;
                      	else
                      		tmp = (-z / a) * t;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
                      code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z * t), $MachinePrecision], 5e+287], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[((-z) / a), $MachinePrecision] * t), $MachinePrecision]]
                      
                      \begin{array}{l}
                      [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;z \cdot t \leq 5 \cdot 10^{+287}:\\
                      \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{-z}{a} \cdot t\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if (*.f64 z t) < 5e287

                        1. Initial program 92.5%

                          \[\frac{x \cdot y - z \cdot t}{a} \]
                        2. Add Preprocessing

                        if 5e287 < (*.f64 z t)

                        1. Initial program 53.1%

                          \[\frac{x \cdot y - z \cdot t}{a} \]
                        2. Add Preprocessing
                        3. Step-by-step derivation
                          1. lift-/.f64N/A

                            \[\leadsto \color{blue}{\frac{x \cdot y - z \cdot t}{a}} \]
                          2. lift--.f64N/A

                            \[\leadsto \frac{\color{blue}{x \cdot y - z \cdot t}}{a} \]
                          3. div-subN/A

                            \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
                          4. lift-*.f64N/A

                            \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{z \cdot t}}{a} \]
                          5. *-commutativeN/A

                            \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{t \cdot z}}{a} \]
                          6. associate-/l*N/A

                            \[\leadsto \frac{x \cdot y}{a} - \color{blue}{t \cdot \frac{z}{a}} \]
                          7. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \color{blue}{\left(-t\right)} \cdot \frac{z}{a}\right) \]
                          16. lower-/.f6499.9

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

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

                          \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
                        6. Applied rewrites95.6%

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

                      Alternative 7: 52.5% accurate, 1.5× speedup?

                      \[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \frac{x}{a} \cdot y \end{array} \]
                      NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
                      (FPCore (x y z t a) :precision binary64 (* (/ x a) y))
                      assert(x < y && y < z && z < t && t < a);
                      double code(double x, double y, double z, double t, double a) {
                      	return (x / a) * y;
                      }
                      
                      NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
                      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)
                      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
                          code = (x / a) * y
                      end function
                      
                      assert x < y && y < z && z < t && t < a;
                      public static double code(double x, double y, double z, double t, double a) {
                      	return (x / a) * y;
                      }
                      
                      [x, y, z, t, a] = sort([x, y, z, t, a])
                      def code(x, y, z, t, a):
                      	return (x / a) * y
                      
                      x, y, z, t, a = sort([x, y, z, t, a])
                      function code(x, y, z, t, a)
                      	return Float64(Float64(x / a) * y)
                      end
                      
                      x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
                      function tmp = code(x, y, z, t, a)
                      	tmp = (x / a) * y;
                      end
                      
                      NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
                      code[x_, y_, z_, t_, a_] := N[(N[(x / a), $MachinePrecision] * y), $MachinePrecision]
                      
                      \begin{array}{l}
                      [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
                      \\
                      \frac{x}{a} \cdot y
                      \end{array}
                      
                      Derivation
                      1. Initial program 89.1%

                        \[\frac{x \cdot y - z \cdot t}{a} \]
                      2. Add Preprocessing
                      3. Taylor expanded in x around inf

                        \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
                      4. Step-by-step derivation
                        1. Applied rewrites50.3%

                          \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
                        2. Final simplification50.3%

                          \[\leadsto \frac{x}{a} \cdot y \]
                        3. Add Preprocessing

                        Developer Target 1: 91.7% accurate, 0.5× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                        (FPCore (x y z t a)
                         :precision binary64
                         (let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
                           (if (< z -2.468684968699548e+170)
                             t_1
                             (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
                        double code(double x, double y, double z, double t, double a) {
                        	double t_1 = ((y / a) * x) - ((t / a) * z);
                        	double tmp;
                        	if (z < -2.468684968699548e+170) {
                        		tmp = t_1;
                        	} else if (z < 6.309831121978371e-71) {
                        		tmp = ((x * y) - (z * t)) / a;
                        	} else {
                        		tmp = t_1;
                        	}
                        	return tmp;
                        }
                        
                        module fmin_fmax_functions
                            implicit none
                            private
                            public fmax
                            public fmin
                        
                            interface fmax
                                module procedure fmax88
                                module procedure fmax44
                                module procedure fmax84
                                module procedure fmax48
                            end interface
                            interface fmin
                                module procedure fmin88
                                module procedure fmin44
                                module procedure fmin84
                                module procedure fmin48
                            end interface
                        contains
                            real(8) function fmax88(x, y) result (res)
                                real(8), intent (in) :: x
                                real(8), intent (in) :: y
                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                            end function
                            real(4) function fmax44(x, y) result (res)
                                real(4), intent (in) :: x
                                real(4), intent (in) :: y
                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                            end function
                            real(8) function fmax84(x, y) result(res)
                                real(8), intent (in) :: x
                                real(4), intent (in) :: y
                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                            end function
                            real(8) function fmax48(x, y) result(res)
                                real(4), intent (in) :: x
                                real(8), intent (in) :: y
                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                            end function
                            real(8) function fmin88(x, y) result (res)
                                real(8), intent (in) :: x
                                real(8), intent (in) :: y
                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                            end function
                            real(4) function fmin44(x, y) result (res)
                                real(4), intent (in) :: x
                                real(4), intent (in) :: y
                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                            end function
                            real(8) function fmin84(x, y) result(res)
                                real(8), intent (in) :: x
                                real(4), intent (in) :: y
                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                            end function
                            real(8) function fmin48(x, y) result(res)
                                real(4), intent (in) :: x
                                real(8), intent (in) :: y
                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                            end function
                        end module
                        
                        real(8) function code(x, y, z, t, a)
                        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) :: t_1
                            real(8) :: tmp
                            t_1 = ((y / a) * x) - ((t / a) * z)
                            if (z < (-2.468684968699548d+170)) then
                                tmp = t_1
                            else if (z < 6.309831121978371d-71) then
                                tmp = ((x * y) - (z * t)) / a
                            else
                                tmp = t_1
                            end if
                            code = tmp
                        end function
                        
                        public static double code(double x, double y, double z, double t, double a) {
                        	double t_1 = ((y / a) * x) - ((t / a) * z);
                        	double tmp;
                        	if (z < -2.468684968699548e+170) {
                        		tmp = t_1;
                        	} else if (z < 6.309831121978371e-71) {
                        		tmp = ((x * y) - (z * t)) / a;
                        	} else {
                        		tmp = t_1;
                        	}
                        	return tmp;
                        }
                        
                        def code(x, y, z, t, a):
                        	t_1 = ((y / a) * x) - ((t / a) * z)
                        	tmp = 0
                        	if z < -2.468684968699548e+170:
                        		tmp = t_1
                        	elif z < 6.309831121978371e-71:
                        		tmp = ((x * y) - (z * t)) / a
                        	else:
                        		tmp = t_1
                        	return tmp
                        
                        function code(x, y, z, t, a)
                        	t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z))
                        	tmp = 0.0
                        	if (z < -2.468684968699548e+170)
                        		tmp = t_1;
                        	elseif (z < 6.309831121978371e-71)
                        		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a);
                        	else
                        		tmp = t_1;
                        	end
                        	return tmp
                        end
                        
                        function tmp_2 = code(x, y, z, t, a)
                        	t_1 = ((y / a) * x) - ((t / a) * z);
                        	tmp = 0.0;
                        	if (z < -2.468684968699548e+170)
                        		tmp = t_1;
                        	elseif (z < 6.309831121978371e-71)
                        		tmp = ((x * y) - (z * t)) / a;
                        	else
                        		tmp = t_1;
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
                        \mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
                        \;\;\;\;t\_1\\
                        
                        \mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
                        \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;t\_1\\
                        
                        
                        \end{array}
                        \end{array}
                        

                        Reproduce

                        ?
                        herbie shell --seed 2025022 
                        (FPCore (x y z t a)
                          :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
                          :precision binary64
                        
                          :alt
                          (! :herbie-platform default (if (< z -246868496869954800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6309831121978371/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z)))))
                        
                          (/ (- (* x y) (* z t)) a))