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

Percentage Accurate: 91.2% → 96.7%
Time: 3.8s
Alternatives: 10
Speedup: 0.5×

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 10 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.2% 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: 96.7% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\ [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 -\infty:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{t}, y, -z\right)}{a} \cdot t\\ \mathbf{elif}\;t\_1 \leq 10^{+308}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-z, t, y \cdot x\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{a}, y, z \cdot \left(\frac{-1}{a} \cdot t\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 (<= t_1 (- INFINITY))
     (* (/ (fma (/ x t) y (- z)) a) t)
     (if (<= t_1 1e+308)
       (/ (fma (- z) t (* y x)) a)
       (fma (/ x a) y (* z (* (/ -1.0 a) t)))))))
assert(x < y && y < z && z < t && t < 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 <= -((double) INFINITY)) {
		tmp = (fma((x / t), y, -z) / a) * t;
	} else if (t_1 <= 1e+308) {
		tmp = fma(-z, t, (y * x)) / a;
	} else {
		tmp = fma((x / a), y, (z * ((-1.0 / a) * t)));
	}
	return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a])
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 <= Float64(-Inf))
		tmp = Float64(Float64(fma(Float64(x / t), y, Float64(-z)) / a) * t);
	elseif (t_1 <= 1e+308)
		tmp = Float64(fma(Float64(-z), t, Float64(y * x)) / a);
	else
		tmp = fma(Float64(x / a), y, Float64(z * Float64(Float64(-1.0 / a) * t)));
	end
	return tmp
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(x / t), $MachinePrecision] * y + (-z)), $MachinePrecision] / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 1e+308], N[(N[((-z) * t + N[(y * x), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x / a), $MachinePrecision] * y + N[(z * N[(N[(-1.0 / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[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 -\infty:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{t}, y, -z\right)}{a} \cdot t\\

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

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


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

    1. Initial program 72.9%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{x}{t} \cdot y}{a} + \frac{\mathsf{neg}\left(z\right)}{a}\right) \cdot t \]
      7. div-add-revN/A

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x}{t}, y, \mathsf{neg}\left(z\right)\right)}{a} \cdot t \]
      11. lift-neg.f6489.6

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

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e308

    1. Initial program 98.6%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y + \left(\mathsf{neg}\left(t\right)\right) \cdot z}}{a} \]
      6. mul-1-negN/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot z, t, x \cdot y\right)}}{a} \]
      12. mul-1-negN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(-z, t, \color{blue}{y \cdot x}\right)}{a} \]
      15. lower-*.f6498.6

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

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

    if 1e308 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 63.8%

      \[\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. lift-*.f64N/A

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\left(x \cdot y - \color{blue}{t \cdot z}\right)\right)}{\mathsf{neg}\left(a\right)} \]
      7. frac-2negN/A

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

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

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

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

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

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

        \[\leadsto \frac{x}{a} \cdot y + \frac{\mathsf{neg}\left(\color{blue}{t \cdot z}\right)}{a} \]
      14. mul-1-negN/A

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

        \[\leadsto \frac{x}{a} \cdot y + \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
      16. lower-fma.f64N/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \color{blue}{z \cdot \left(-1 \cdot \frac{t}{a}\right)}\right) \]
      21. associate-*r*N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \left(-z\right) \cdot \frac{\color{blue}{t \cdot -1}}{\mathsf{neg}\left(a\right)}\right) \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \left(-z\right) \cdot \frac{t \cdot -1}{\color{blue}{-1 \cdot a}}\right) \]
      6. times-fracN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \left(-z\right) \cdot \left(\frac{-1}{a} \cdot \color{blue}{\frac{\mathsf{neg}\left(t\right)}{\mathsf{neg}\left(-1\right)}}\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \left(-z\right) \cdot \left(\frac{-1}{a} \cdot \frac{\mathsf{neg}\left(t\right)}{\color{blue}{1}}\right)\right) \]
      6. /-rgt-identityN/A

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \left(-z\right) \cdot \color{blue}{\left(\frac{-1}{a} \cdot \left(\mathsf{neg}\left(t\right)\right)\right)}\right) \]
      8. lift-neg.f6499.9

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

      \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \left(-z\right) \cdot \color{blue}{\left(\frac{-1}{a} \cdot \left(-t\right)\right)}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification97.8%

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

Alternative 2: 95.8% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\ [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 -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+229}\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{t}, y, -z\right)}{a} \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-z, t, y \cdot x\right)}{a}\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 (- INFINITY)) (not (<= t_1 5e+229)))
     (* (/ (fma (/ x t) y (- z)) a) t)
     (/ (fma (- z) t (* y x)) a))))
assert(x < y && y < z && z < t && t < 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 <= -((double) INFINITY)) || !(t_1 <= 5e+229)) {
		tmp = (fma((x / t), y, -z) / a) * t;
	} else {
		tmp = fma(-z, t, (y * x)) / a;
	}
	return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a])
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 <= Float64(-Inf)) || !(t_1 <= 5e+229))
		tmp = Float64(Float64(fma(Float64(x / t), y, Float64(-z)) / a) * t);
	else
		tmp = Float64(fma(Float64(-z), t, Float64(y * x)) / a);
	end
	return tmp
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+229]], $MachinePrecision]], N[(N[(N[(N[(x / t), $MachinePrecision] * y + (-z)), $MachinePrecision] / a), $MachinePrecision] * t), $MachinePrecision], N[(N[((-z) * t + N[(y * x), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[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 -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+229}\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{t}, y, -z\right)}{a} \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 5.0000000000000005e229 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 75.0%

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

      \[\leadsto \color{blue}{t \cdot \left(-1 \cdot \frac{z}{a} + \frac{x \cdot y}{a \cdot t}\right)} \]
    4. Applied rewrites89.8%

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{x}{t} \cdot y}{a} + \frac{\mathsf{neg}\left(z\right)}{a}\right) \cdot t \]
      7. div-add-revN/A

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x}{t}, y, \mathsf{neg}\left(z\right)\right)}{a} \cdot t \]
      11. lift-neg.f6491.5

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

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000005e229

    1. Initial program 98.5%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y + \left(\mathsf{neg}\left(t\right)\right) \cdot z}}{a} \]
      6. mul-1-negN/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot z, t, x \cdot y\right)}}{a} \]
      12. mul-1-negN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(-z, t, \color{blue}{y \cdot x}\right)}{a} \]
      15. lower-*.f6498.5

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-z, t, y \cdot x\right)}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.7%

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

Alternative 3: 96.7% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\ [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 -\infty:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{t}, y, -z\right)}{a} \cdot t\\ \mathbf{elif}\;t\_1 \leq 10^{+308}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-z, t, y \cdot x\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{a}, y, \left(-z\right) \cdot \frac{t}{a}\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 (<= t_1 (- INFINITY))
     (* (/ (fma (/ x t) y (- z)) a) t)
     (if (<= t_1 1e+308)
       (/ (fma (- z) t (* y x)) a)
       (fma (/ x a) y (* (- z) (/ t a)))))))
assert(x < y && y < z && z < t && t < 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 <= -((double) INFINITY)) {
		tmp = (fma((x / t), y, -z) / a) * t;
	} else if (t_1 <= 1e+308) {
		tmp = fma(-z, t, (y * x)) / a;
	} else {
		tmp = fma((x / a), y, (-z * (t / a)));
	}
	return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a])
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 <= Float64(-Inf))
		tmp = Float64(Float64(fma(Float64(x / t), y, Float64(-z)) / a) * t);
	elseif (t_1 <= 1e+308)
		tmp = Float64(fma(Float64(-z), t, Float64(y * x)) / a);
	else
		tmp = fma(Float64(x / a), y, Float64(Float64(-z) * Float64(t / a)));
	end
	return tmp
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(x / t), $MachinePrecision] * y + (-z)), $MachinePrecision] / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 1e+308], N[(N[((-z) * t + N[(y * x), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x / a), $MachinePrecision] * y + N[((-z) * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[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 -\infty:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{t}, y, -z\right)}{a} \cdot t\\

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

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


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

    1. Initial program 72.9%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\frac{x}{t} \cdot y}{a} + \frac{\mathsf{neg}\left(z\right)}{a}\right) \cdot t \]
      7. div-add-revN/A

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x}{t}, y, \mathsf{neg}\left(z\right)\right)}{a} \cdot t \]
      11. lift-neg.f6489.6

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

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e308

    1. Initial program 98.6%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y + \left(\mathsf{neg}\left(t\right)\right) \cdot z}}{a} \]
      6. mul-1-negN/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot z, t, x \cdot y\right)}}{a} \]
      12. mul-1-negN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(-z, t, \color{blue}{y \cdot x}\right)}{a} \]
      15. lower-*.f6498.6

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

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

    if 1e308 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 63.8%

      \[\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. lift-*.f64N/A

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\left(x \cdot y - \color{blue}{t \cdot z}\right)\right)}{\mathsf{neg}\left(a\right)} \]
      7. frac-2negN/A

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

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

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

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

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

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

        \[\leadsto \frac{x}{a} \cdot y + \frac{\mathsf{neg}\left(\color{blue}{t \cdot z}\right)}{a} \]
      14. mul-1-negN/A

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

        \[\leadsto \frac{x}{a} \cdot y + \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
      16. lower-fma.f64N/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \color{blue}{z \cdot \left(-1 \cdot \frac{t}{a}\right)}\right) \]
      21. associate-*r*N/A

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{a}, y, \left(-z\right) \cdot \frac{t}{a}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification97.7%

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

Alternative 4: 94.4% accurate, 0.4× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\ [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;\frac{x \cdot y - z \cdot t}{a} \leq 10^{+306}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-z, t, y \cdot x\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{-t}{y}, z, x\right)}{a} \cdot y\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 (<= (/ (- (* x y) (* z t)) a) 1e+306)
   (/ (fma (- z) t (* y x)) a)
   (* (/ (fma (/ (- t) y) z x) a) y)))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((((x * y) - (z * t)) / a) <= 1e+306) {
		tmp = fma(-z, t, (y * x)) / a;
	} else {
		tmp = (fma((-t / y), z, x) / a) * y;
	}
	return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a])
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(Float64(Float64(x * y) - Float64(z * t)) / a) <= 1e+306)
		tmp = Float64(fma(Float64(-z), t, Float64(y * x)) / a);
	else
		tmp = Float64(Float64(fma(Float64(Float64(-t) / y), z, x) / a) * y);
	end
	return tmp
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], 1e+306], N[(N[((-z) * t + N[(y * x), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(N[(N[((-t) / y), $MachinePrecision] * z + x), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot y - z \cdot t}{a} \leq 10^{+306}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, t, y \cdot x\right)}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < 1.00000000000000002e306

    1. Initial program 93.7%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y + \left(\mathsf{neg}\left(t\right)\right) \cdot z}}{a} \]
      6. mul-1-negN/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot z, t, x \cdot y\right)}}{a} \]
      12. mul-1-negN/A

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

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

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

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

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

    if 1.00000000000000002e306 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a)

    1. Initial program 85.6%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y + \left(\mathsf{neg}\left(t\right)\right) \cdot z}}{a} \]
      6. mul-1-negN/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot z, t, x \cdot y\right)}}{a} \]
      12. mul-1-negN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(-z, t, \color{blue}{y \cdot x}\right)}{a} \]
      15. lower-*.f6485.6

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-z, t, y \cdot x\right)}{a}} \]
    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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-t}{y}, \frac{z}{a}, \frac{x}{a}\right) \cdot y \]
      12. lower-/.f6481.0

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-t}{y}, \frac{z}{a}, \frac{x}{a}\right) \cdot y} \]
    8. Step-by-step derivation
      1. +-commutative81.0

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{-t}}{y}, \frac{z}{a}, \frac{x}{a}\right) \cdot y \]
      3. distribute-lft-neg-out81.0

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

        \[\leadsto \mathsf{fma}\left(\frac{-t}{y}, \frac{z}{a}, \frac{x}{a}\right) \cdot y \]
      5. mul-1-neg81.0

        \[\leadsto \mathsf{fma}\left(\frac{-t}{\color{blue}{y}}, \frac{z}{a}, \frac{x}{a}\right) \cdot y \]
      6. div-add-rev81.0

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-t}{y}, \frac{z}{a}, \frac{x}{a}\right) \cdot y \]
      10. mul-1-neg81.0

        \[\leadsto \mathsf{fma}\left(\frac{-t}{y}, \frac{z}{a}, \frac{x}{a}\right) \cdot y \]
      11. *-commutative81.0

        \[\leadsto \mathsf{fma}\left(\frac{-t}{y}, \frac{z}{a}, \frac{x}{a}\right) \cdot y \]
      12. distribute-lft-neg-out81.0

        \[\leadsto \mathsf{fma}\left(\frac{-t}{y}, \frac{z}{a}, \frac{x}{a}\right) \cdot y \]
      13. *-commutative81.0

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

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

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

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

Alternative 5: 74.5% accurate, 0.4× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\ [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := x \cdot \frac{y}{a}\\ \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+119}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+93}:\\ \;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+17}:\\ \;\;\;\;\frac{y \cdot x}{a}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+95}:\\ \;\;\;\;\frac{\left(-z\right) \cdot t}{a}\\ \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.
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 a))))
   (if (<= (* x y) -2e+119)
     t_1
     (if (<= (* x y) -5e+93)
       (* (- t) (/ z a))
       (if (<= (* x y) -5e+17)
         (/ (* y x) a)
         (if (<= (* x y) 5e+95) (/ (* (- z) t) a) t_1))))))
assert(x < y && y < z && z < t && t < 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 / a);
	double tmp;
	if ((x * y) <= -2e+119) {
		tmp = t_1;
	} else if ((x * y) <= -5e+93) {
		tmp = -t * (z / a);
	} else if ((x * y) <= -5e+17) {
		tmp = (y * x) / a;
	} else if ((x * y) <= 5e+95) {
		tmp = (-z * t) / a;
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 = x * (y / a)
    if ((x * y) <= (-2d+119)) then
        tmp = t_1
    else if ((x * y) <= (-5d+93)) then
        tmp = -t * (z / a)
    else if ((x * y) <= (-5d+17)) then
        tmp = (y * x) / a
    else if ((x * y) <= 5d+95) then
        tmp = (-z * t) / a
    else
        tmp = t_1
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a;
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 = x * (y / a);
	double tmp;
	if ((x * y) <= -2e+119) {
		tmp = t_1;
	} else if ((x * y) <= -5e+93) {
		tmp = -t * (z / a);
	} else if ((x * y) <= -5e+17) {
		tmp = (y * x) / a;
	} else if ((x * y) <= 5e+95) {
		tmp = (-z * t) / a;
	} else {
		tmp = t_1;
	}
	return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a])
[x, y, z, t, a] = sort([x, y, z, t, a])
def code(x, y, z, t, a):
	t_1 = x * (y / a)
	tmp = 0
	if (x * y) <= -2e+119:
		tmp = t_1
	elif (x * y) <= -5e+93:
		tmp = -t * (z / a)
	elif (x * y) <= -5e+17:
		tmp = (y * x) / a
	elif (x * y) <= 5e+95:
		tmp = (-z * t) / a
	else:
		tmp = t_1
	return tmp
x, y, z, t, a = sort([x, y, z, t, a])
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	t_1 = Float64(x * Float64(y / a))
	tmp = 0.0
	if (Float64(x * y) <= -2e+119)
		tmp = t_1;
	elseif (Float64(x * y) <= -5e+93)
		tmp = Float64(Float64(-t) * Float64(z / a));
	elseif (Float64(x * y) <= -5e+17)
		tmp = Float64(Float64(y * x) / a);
	elseif (Float64(x * y) <= 5e+95)
		tmp = Float64(Float64(Float64(-z) * t) / a);
	else
		tmp = t_1;
	end
	return tmp
end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
	t_1 = x * (y / a);
	tmp = 0.0;
	if ((x * y) <= -2e+119)
		tmp = t_1;
	elseif ((x * y) <= -5e+93)
		tmp = -t * (z / a);
	elseif ((x * y) <= -5e+17)
		tmp = (y * x) / a;
	elseif ((x * y) <= 5e+95)
		tmp = (-z * t) / a;
	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.
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[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+119], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -5e+93], N[((-t) * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5e+17], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+95], N[(N[((-z) * t), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{a}\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+119}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+93}:\\
\;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\

\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+17}:\\
\;\;\;\;\frac{y \cdot x}{a}\\

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+95}:\\
\;\;\;\;\frac{\left(-z\right) \cdot t}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -1.99999999999999989e119 or 5.00000000000000025e95 < (*.f64 x y)

    1. Initial program 88.4%

      \[\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. lift-*.f64N/A

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\left(x \cdot y - \color{blue}{t \cdot z}\right)\right)}{\mathsf{neg}\left(a\right)} \]
      7. frac-2negN/A

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

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

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

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

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

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

        \[\leadsto \frac{x}{a} \cdot y + \frac{\mathsf{neg}\left(\color{blue}{t \cdot z}\right)}{a} \]
      14. mul-1-negN/A

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

        \[\leadsto \frac{x}{a} \cdot y + \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
      16. lower-fma.f64N/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \color{blue}{z \cdot \left(-1 \cdot \frac{t}{a}\right)}\right) \]
      21. associate-*r*N/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    6. Step-by-step derivation
      1. associate-*l/N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      3. lift-*.f64N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      5. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
      6. lift-neg.f64N/A

        \[\leadsto \frac{x \cdot y}{a} \]
      7. lift-*.f64N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      9. associate-*r/N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      11. div-addN/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
    7. Applied rewrites85.2%

      \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \frac{x}{a} \cdot y \]
      3. associate-*l/N/A

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

        \[\leadsto x \cdot \color{blue}{\frac{y}{a}} \]
      5. lower-*.f64N/A

        \[\leadsto x \cdot \color{blue}{\frac{y}{a}} \]
      6. lift-/.f6486.3

        \[\leadsto x \cdot \frac{y}{\color{blue}{a}} \]
    9. Applied rewrites86.3%

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

    if -1.99999999999999989e119 < (*.f64 x y) < -5.0000000000000001e93

    1. Initial program 90.3%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y + \left(\mathsf{neg}\left(t\right)\right) \cdot z}}{a} \]
      6. mul-1-negN/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot z, t, x \cdot y\right)}}{a} \]
      12. mul-1-negN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(-z, t, \color{blue}{y \cdot x}\right)}{a} \]
      15. lower-*.f6490.3

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

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

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

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

    if -5.0000000000000001e93 < (*.f64 x y) < -5e17

    1. Initial program 86.3%

      \[\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. *-commutativeN/A

        \[\leadsto \frac{y \cdot \color{blue}{x}}{a} \]
      2. lower-*.f6478.5

        \[\leadsto \frac{y \cdot \color{blue}{x}}{a} \]
    5. Applied rewrites78.5%

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

    if -5e17 < (*.f64 x y) < 5.00000000000000025e95

    1. Initial program 95.1%

      \[\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. *-commutativeN/A

        \[\leadsto \frac{-1 \cdot \left(z \cdot \color{blue}{t}\right)}{a} \]
      2. associate-*r*N/A

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

        \[\leadsto \frac{\left(-1 \cdot z\right) \cdot \color{blue}{t}}{a} \]
      4. mul-1-negN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(z\right)\right) \cdot t}{a} \]
      5. lower-neg.f6479.6

        \[\leadsto \frac{\left(-z\right) \cdot t}{a} \]
    5. Applied rewrites79.6%

      \[\leadsto \frac{\color{blue}{\left(-z\right) \cdot t}}{a} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification82.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+119}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+93}:\\ \;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+17}:\\ \;\;\;\;\frac{y \cdot x}{a}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+95}:\\ \;\;\;\;\frac{\left(-z\right) \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 94.9% accurate, 0.5× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -5.0000000000000004e301 or 1.00000000000000005e236 < (*.f64 z t)

    1. Initial program 74.7%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y + \left(\mathsf{neg}\left(t\right)\right) \cdot z}}{a} \]
      6. mul-1-negN/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot z, t, x \cdot y\right)}}{a} \]
      12. mul-1-negN/A

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

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

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

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

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

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

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

    if -5.0000000000000004e301 < (*.f64 z t) < 1.00000000000000005e236

    1. Initial program 95.6%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y + \left(\mathsf{neg}\left(t\right)\right) \cdot z}}{a} \]
      6. mul-1-negN/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot z, t, x \cdot y\right)}}{a} \]
      12. mul-1-negN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-z, t, y \cdot x\right)}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification95.9%

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

Alternative 7: 94.9% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\ [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+301} \lor \neg \left(z \cdot t \leq 10^{+236}\right):\\ \;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 (or (<= (* z t) -5e+301) (not (<= (* z t) 1e+236)))
   (* (- t) (/ z a))
   (/ (- (* x y) (* z t)) a)))
assert(x < y && y < z && z < t && t < a);
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+301) || !((z * t) <= 1e+236)) {
		tmp = -t * (z / a);
	} else {
		tmp = ((x * y) - (z * t)) / a;
	}
	return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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+301)) .or. (.not. ((z * t) <= 1d+236))) then
        tmp = -t * (z / a)
    else
        tmp = ((x * y) - (z * t)) / a
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a;
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+301) || !((z * t) <= 1e+236)) {
		tmp = -t * (z / a);
	} else {
		tmp = ((x * y) - (z * t)) / a;
	}
	return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a])
[x, y, z, t, a] = sort([x, y, z, t, a])
def code(x, y, z, t, a):
	tmp = 0
	if ((z * t) <= -5e+301) or not ((z * t) <= 1e+236):
		tmp = -t * (z / a)
	else:
		tmp = ((x * y) - (z * t)) / a
	return tmp
x, y, z, t, a = sort([x, y, z, t, a])
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+301) || !(Float64(z * t) <= 1e+236))
		tmp = Float64(Float64(-t) * Float64(z / a));
	else
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a);
	end
	return tmp
end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
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+301) || ~(((z * t) <= 1e+236)))
		tmp = -t * (z / a);
	else
		tmp = ((x * y) - (z * t)) / a;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -5e+301], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1e+236]], $MachinePrecision]], N[((-t) * N[(z / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+301} \lor \neg \left(z \cdot t \leq 10^{+236}\right):\\
\;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -5.0000000000000004e301 or 1.00000000000000005e236 < (*.f64 z t)

    1. Initial program 74.7%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y + \left(\mathsf{neg}\left(t\right)\right) \cdot z}}{a} \]
      6. mul-1-negN/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot z, t, x \cdot y\right)}}{a} \]
      12. mul-1-negN/A

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

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

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

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

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

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

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

    if -5.0000000000000004e301 < (*.f64 z t) < 1.00000000000000005e236

    1. Initial program 95.6%

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

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

Alternative 8: 71.3% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\ [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+119} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+125}\right):\\ \;\;\;\;x \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 (or (<= (* x y) -2e+119) (not (<= (* x y) 5e+125)))
   (* x (/ y a))
   (* (- t) (/ z a))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (((x * y) <= -2e+119) || !((x * y) <= 5e+125)) {
		tmp = x * (y / a);
	} else {
		tmp = -t * (z / a);
	}
	return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 (((x * y) <= (-2d+119)) .or. (.not. ((x * y) <= 5d+125))) then
        tmp = x * (y / a)
    else
        tmp = -t * (z / a)
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a;
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 (((x * y) <= -2e+119) || !((x * y) <= 5e+125)) {
		tmp = x * (y / a);
	} else {
		tmp = -t * (z / a);
	}
	return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a])
[x, y, z, t, a] = sort([x, y, z, t, a])
def code(x, y, z, t, a):
	tmp = 0
	if ((x * y) <= -2e+119) or not ((x * y) <= 5e+125):
		tmp = x * (y / a)
	else:
		tmp = -t * (z / a)
	return tmp
x, y, z, t, a = sort([x, y, z, t, a])
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	tmp = 0.0
	if ((Float64(x * y) <= -2e+119) || !(Float64(x * y) <= 5e+125))
		tmp = Float64(x * Float64(y / a));
	else
		tmp = Float64(Float64(-t) * Float64(z / a));
	end
	return tmp
end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
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 (((x * y) <= -2e+119) || ~(((x * y) <= 5e+125)))
		tmp = x * (y / a);
	else
		tmp = -t * (z / a);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -2e+119], N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e+125]], $MachinePrecision]], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[((-t) * N[(z / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+119} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+125}\right):\\
\;\;\;\;x \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -1.99999999999999989e119 or 4.99999999999999962e125 < (*.f64 x y)

    1. Initial program 88.9%

      \[\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. lift-*.f64N/A

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\left(x \cdot y - \color{blue}{t \cdot z}\right)\right)}{\mathsf{neg}\left(a\right)} \]
      7. frac-2negN/A

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

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

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

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

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

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

        \[\leadsto \frac{x}{a} \cdot y + \frac{\mathsf{neg}\left(\color{blue}{t \cdot z}\right)}{a} \]
      14. mul-1-negN/A

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

        \[\leadsto \frac{x}{a} \cdot y + \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
      16. lower-fma.f64N/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \color{blue}{z \cdot \left(-1 \cdot \frac{t}{a}\right)}\right) \]
      21. associate-*r*N/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    6. Step-by-step derivation
      1. associate-*l/N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      3. lift-*.f64N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      5. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
      6. lift-neg.f64N/A

        \[\leadsto \frac{x \cdot y}{a} \]
      7. lift-*.f64N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      9. associate-*r/N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      11. div-addN/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
    7. Applied rewrites87.4%

      \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \frac{x}{a} \cdot y \]
      3. associate-*l/N/A

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

        \[\leadsto x \cdot \color{blue}{\frac{y}{a}} \]
      5. lower-*.f64N/A

        \[\leadsto x \cdot \color{blue}{\frac{y}{a}} \]
      6. lift-/.f6488.6

        \[\leadsto x \cdot \frac{y}{\color{blue}{a}} \]
    9. Applied rewrites88.6%

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

    if -1.99999999999999989e119 < (*.f64 x y) < 4.99999999999999962e125

    1. Initial program 93.7%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y + \left(\mathsf{neg}\left(t\right)\right) \cdot z}}{a} \]
      6. mul-1-negN/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot z, t, x \cdot y\right)}}{a} \]
      12. mul-1-negN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(-z, t, \color{blue}{y \cdot x}\right)}{a} \]
      15. lower-*.f6493.8

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

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

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

      \[\leadsto \color{blue}{\left(-t\right) \cdot \frac{z}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification77.9%

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

Alternative 9: 50.9% accurate, 1.1× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\ [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq 4.2 \cdot 10^{-286}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \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.
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 (<= t 4.2e-286) (* x (/ y a)) (* (/ x a) y)))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= 4.2e-286) {
		tmp = x * (y / a);
	} else {
		tmp = (x / a) * y;
	}
	return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 (t <= 4.2d-286) then
        tmp = x * (y / a)
    else
        tmp = (x / a) * y
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a;
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 (t <= 4.2e-286) {
		tmp = x * (y / a);
	} else {
		tmp = (x / a) * y;
	}
	return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a])
[x, y, z, t, a] = sort([x, y, z, t, a])
def code(x, y, z, t, a):
	tmp = 0
	if t <= 4.2e-286:
		tmp = x * (y / a)
	else:
		tmp = (x / a) * y
	return tmp
x, y, z, t, a = sort([x, y, z, t, a])
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	tmp = 0.0
	if (t <= 4.2e-286)
		tmp = Float64(x * Float64(y / a));
	else
		tmp = Float64(Float64(x / a) * y);
	end
	return tmp
end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
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 (t <= 4.2e-286)
		tmp = x * (y / a);
	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.
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[t, 4.2e-286], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(N[(x / a), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4.2 \cdot 10^{-286}:\\
\;\;\;\;x \cdot \frac{y}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{a} \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 4.19999999999999977e-286

    1. Initial program 96.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. lift-*.f64N/A

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\left(x \cdot y - \color{blue}{t \cdot z}\right)\right)}{\mathsf{neg}\left(a\right)} \]
      7. frac-2negN/A

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

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

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

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

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

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

        \[\leadsto \frac{x}{a} \cdot y + \frac{\mathsf{neg}\left(\color{blue}{t \cdot z}\right)}{a} \]
      14. mul-1-negN/A

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

        \[\leadsto \frac{x}{a} \cdot y + \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
      16. lower-fma.f64N/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \color{blue}{z \cdot \left(-1 \cdot \frac{t}{a}\right)}\right) \]
      21. associate-*r*N/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    6. Step-by-step derivation
      1. associate-*l/N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      3. lift-*.f64N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      5. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
      6. lift-neg.f64N/A

        \[\leadsto \frac{x \cdot y}{a} \]
      7. lift-*.f64N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      9. associate-*r/N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      11. div-addN/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
    7. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \frac{x}{a} \cdot y \]
      3. associate-*l/N/A

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

        \[\leadsto x \cdot \color{blue}{\frac{y}{a}} \]
      5. lower-*.f64N/A

        \[\leadsto x \cdot \color{blue}{\frac{y}{a}} \]
      6. lift-/.f6446.2

        \[\leadsto x \cdot \frac{y}{\color{blue}{a}} \]
    9. Applied rewrites46.2%

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

    if 4.19999999999999977e-286 < t

    1. Initial program 88.4%

      \[\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. lift-*.f64N/A

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\left(x \cdot y - \color{blue}{t \cdot z}\right)\right)}{\mathsf{neg}\left(a\right)} \]
      7. frac-2negN/A

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

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

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

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

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

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

        \[\leadsto \frac{x}{a} \cdot y + \frac{\mathsf{neg}\left(\color{blue}{t \cdot z}\right)}{a} \]
      14. mul-1-negN/A

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

        \[\leadsto \frac{x}{a} \cdot y + \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
      16. lower-fma.f64N/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \color{blue}{z \cdot \left(-1 \cdot \frac{t}{a}\right)}\right) \]
      21. associate-*r*N/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    6. Step-by-step derivation
      1. associate-*l/N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      3. lift-*.f64N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      5. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
      6. lift-neg.f64N/A

        \[\leadsto \frac{x \cdot y}{a} \]
      7. lift-*.f64N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      9. associate-*r/N/A

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

        \[\leadsto \frac{x \cdot y}{a} \]
      11. div-addN/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
    7. Applied rewrites47.7%

      \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification47.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 4.2 \cdot 10^{-286}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a} \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 50.9% accurate, 1.5× speedup?

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

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

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

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

      \[\leadsto \frac{\mathsf{neg}\left(\left(x \cdot y - \color{blue}{t \cdot z}\right)\right)}{\mathsf{neg}\left(a\right)} \]
    7. frac-2negN/A

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

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

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

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

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

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

      \[\leadsto \frac{x}{a} \cdot y + \frac{\mathsf{neg}\left(\color{blue}{t \cdot z}\right)}{a} \]
    14. mul-1-negN/A

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

      \[\leadsto \frac{x}{a} \cdot y + \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
    16. lower-fma.f64N/A

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{x}{a}, y, \color{blue}{z \cdot \left(-1 \cdot \frac{t}{a}\right)}\right) \]
    21. associate-*r*N/A

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

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

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

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

    \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
  6. Step-by-step derivation
    1. associate-*l/N/A

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

      \[\leadsto \frac{x \cdot y}{a} \]
    3. lift-*.f64N/A

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

      \[\leadsto \frac{x \cdot y}{a} \]
    5. +-commutativeN/A

      \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
    6. lift-neg.f64N/A

      \[\leadsto \frac{x \cdot y}{a} \]
    7. lift-*.f64N/A

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

      \[\leadsto \frac{x \cdot y}{a} \]
    9. associate-*r/N/A

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

      \[\leadsto \frac{x \cdot y}{a} \]
    11. div-addN/A

      \[\leadsto \frac{\color{blue}{x \cdot y}}{a} \]
  7. Applied rewrites45.5%

    \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
  8. Step-by-step derivation
    1. lift-*.f64N/A

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

      \[\leadsto \frac{x}{a} \cdot y \]
    3. associate-*l/N/A

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

      \[\leadsto x \cdot \color{blue}{\frac{y}{a}} \]
    5. lower-*.f64N/A

      \[\leadsto x \cdot \color{blue}{\frac{y}{a}} \]
    6. lift-/.f6447.7

      \[\leadsto x \cdot \frac{y}{\color{blue}{a}} \]
  9. Applied rewrites47.7%

    \[\leadsto x \cdot \color{blue}{\frac{y}{a}} \]
  10. Final simplification47.7%

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

Reproduce

?
herbie shell --seed 2025085 
(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))