Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I

Percentage Accurate: 91.2% → 97.2%
Time: 6.1s
Alternatives: 11
Speedup: 0.7×

Specification

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

\\
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

\\
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\end{array}

Alternative 1: 97.2% accurate, 0.4× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{a}, -4.5 \cdot t, \frac{y}{a + a} \cdot x\right)\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+273}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t \cdot z\right) \cdot -9\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{a}, -4.5 \cdot t, \frac{x}{a + a} \cdot y\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (* x y) (* (* z 9.0) t))))
   (if (<= t_1 (- INFINITY))
     (fma (/ z a) (* -4.5 t) (* (/ y (+ a a)) x))
     (if (<= t_1 2e+273)
       (/ (fma y x (* (* t z) -9.0)) (* a 2.0))
       (fma (/ z a) (* -4.5 t) (* (/ x (+ a a)) y))))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x * y) - ((z * 9.0) * t);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = fma((z / a), (-4.5 * t), ((y / (a + a)) * x));
	} else if (t_1 <= 2e+273) {
		tmp = fma(y, x, ((t * z) * -9.0)) / (a * 2.0);
	} else {
		tmp = fma((z / a), (-4.5 * t), ((x / (a + a)) * y));
	}
	return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = fma(Float64(z / a), Float64(-4.5 * t), Float64(Float64(y / Float64(a + a)) * x));
	elseif (t_1 <= 2e+273)
		tmp = Float64(fma(y, x, Float64(Float64(t * z) * -9.0)) / Float64(a * 2.0));
	else
		tmp = fma(Float64(z / a), Float64(-4.5 * t), Float64(Float64(x / Float64(a + a)) * y));
	end
	return tmp
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(z / a), $MachinePrecision] * N[(-4.5 * t), $MachinePrecision] + N[(N[(y / N[(a + a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+273], N[(N[(y * x + N[(N[(t * z), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * N[(-4.5 * t), $MachinePrecision] + N[(N[(x / N[(a + a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, -4.5 \cdot t, \frac{y}{a + a} \cdot x\right)\\

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

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


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

    1. Initial program 91.2%

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      2. sub-flipN/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{t \cdot z}, \mathsf{neg}\left(9\right), x \cdot y\right)}{a \cdot 2} \]
      11. metadata-eval91.3

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(t \cdot z, -9, y \cdot x\right)}{\color{blue}{a + a}} \]
      18. lower-+.f6491.3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < 1.99999999999999989e273

    1. Initial program 91.2%

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      2. sub-flipN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \mathsf{neg}\left(\color{blue}{\left(t \cdot z\right) \cdot 9}\right)\right)}{a \cdot 2} \]
      10. distribute-rgt-neg-inN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \color{blue}{\left(t \cdot z\right)} \cdot \left(\mathsf{neg}\left(9\right)\right)\right)}{a \cdot 2} \]
      13. metadata-eval91.5

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

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

    if 1.99999999999999989e273 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t))

    1. Initial program 91.2%

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      3. sub-flipN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{\mathsf{neg}\left(\left(z \cdot 9\right) \cdot t\right)}{a} + \frac{y}{a} \cdot x}{2}} \]
    3. Applied rewrites88.1%

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

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

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

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

        \[\leadsto \frac{t \cdot \color{blue}{\frac{-9 \cdot z}{a}}}{2} + \frac{\frac{y}{a} \cdot x}{2} \]
      5. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.2% accurate, 0.4× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := \mathsf{fma}\left(\frac{z}{a}, -4.5 \cdot t, \frac{x}{a + a} \cdot y\right)\\ t_2 := x \cdot y - \left(z \cdot 9\right) \cdot t\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+273}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t \cdot z\right) \cdot -9\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma (/ z a) (* -4.5 t) (* (/ x (+ a a)) y)))
        (t_2 (- (* x y) (* (* z 9.0) t))))
   (if (<= t_2 (- INFINITY))
     t_1
     (if (<= t_2 2e+273) (/ (fma y x (* (* t z) -9.0)) (* a 2.0)) t_1))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma((z / a), (-4.5 * t), ((x / (a + a)) * y));
	double t_2 = (x * y) - ((z * 9.0) * t);
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = t_1;
	} else if (t_2 <= 2e+273) {
		tmp = fma(y, x, ((t * z) * -9.0)) / (a * 2.0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	t_1 = fma(Float64(z / a), Float64(-4.5 * t), Float64(Float64(x / Float64(a + a)) * y))
	t_2 = Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = t_1;
	elseif (t_2 <= 2e+273)
		tmp = Float64(fma(y, x, Float64(Float64(t * z) * -9.0)) / Float64(a * 2.0));
	else
		tmp = t_1;
	end
	return tmp
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / a), $MachinePrecision] * N[(-4.5 * t), $MachinePrecision] + N[(N[(x / N[(a + a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 2e+273], N[(N[(y * x + N[(N[(t * z), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{a}, -4.5 \cdot t, \frac{x}{a + a} \cdot y\right)\\
t_2 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\

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

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


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

    1. Initial program 91.2%

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      3. sub-flipN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{\mathsf{neg}\left(\left(z \cdot 9\right) \cdot t\right)}{a} + \frac{y}{a} \cdot x}{2}} \]
    3. Applied rewrites88.1%

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

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

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

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

        \[\leadsto \frac{t \cdot \color{blue}{\frac{-9 \cdot z}{a}}}{2} + \frac{\frac{y}{a} \cdot x}{2} \]
      5. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < 1.99999999999999989e273

    1. Initial program 91.2%

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      2. sub-flipN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \mathsf{neg}\left(\color{blue}{\left(t \cdot z\right) \cdot 9}\right)\right)}{a \cdot 2} \]
      10. distribute-rgt-neg-inN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \color{blue}{\left(t \cdot z\right)} \cdot \left(\mathsf{neg}\left(9\right)\right)\right)}{a \cdot 2} \]
      13. metadata-eval91.5

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

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

Alternative 3: 93.5% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq 60000000:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t \cdot z\right) \cdot -9\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(t, \frac{-9 \cdot z}{a}, \frac{y}{a} \cdot x\right)}{2}\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= a 60000000.0)
   (/ (fma y x (* (* t z) -9.0)) (* a 2.0))
   (/ (fma t (/ (* -9.0 z) a) (* (/ y a) x)) 2.0)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= 60000000.0) {
		tmp = fma(y, x, ((t * z) * -9.0)) / (a * 2.0);
	} else {
		tmp = fma(t, ((-9.0 * z) / a), ((y / a) * x)) / 2.0;
	}
	return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= 60000000.0)
		tmp = Float64(fma(y, x, Float64(Float64(t * z) * -9.0)) / Float64(a * 2.0));
	else
		tmp = Float64(fma(t, Float64(Float64(-9.0 * z) / a), Float64(Float64(y / a) * x)) / 2.0);
	end
	return tmp
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 60000000.0], N[(N[(y * x + N[(N[(t * z), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(t * N[(N[(-9.0 * z), $MachinePrecision] / a), $MachinePrecision] + N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 60000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t \cdot z\right) \cdot -9\right)}{a \cdot 2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 6e7

    1. Initial program 91.2%

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      2. sub-flipN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \mathsf{neg}\left(\color{blue}{\left(t \cdot z\right) \cdot 9}\right)\right)}{a \cdot 2} \]
      10. distribute-rgt-neg-inN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \color{blue}{\left(t \cdot z\right)} \cdot \left(\mathsf{neg}\left(9\right)\right)\right)}{a \cdot 2} \]
      13. metadata-eval91.5

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

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

    if 6e7 < a

    1. Initial program 91.2%

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      3. sub-flipN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{\mathsf{neg}\left(\left(z \cdot 9\right) \cdot t\right)}{a} + \frac{y}{a} \cdot x}{2}} \]
    3. Applied rewrites88.1%

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

Alternative 4: 93.1% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 z #s(literal 9 binary64)) t) < -2.0000000000000001e276

    1. Initial program 91.2%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{-9}{2} \cdot \frac{t \cdot z}{a}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      3. lower-*.f6451.5

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} \]
    4. Applied rewrites51.5%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. metadata-evalN/A

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

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      4. times-fracN/A

        \[\leadsto \frac{-9 \cdot \left(t \cdot z\right)}{\color{blue}{2 \cdot a}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-9 \cdot \left(t \cdot z\right)}{2 \cdot a} \]
      6. associate-*l*N/A

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{\color{blue}{2} \cdot a} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{2 \cdot a} \]
      8. *-commutativeN/A

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

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{a \cdot \color{blue}{2}} \]
      10. lift-*.f64N/A

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{a \cdot 2} \]
      11. *-commutativeN/A

        \[\leadsto \frac{\left(t \cdot -9\right) \cdot z}{a \cdot 2} \]
      12. associate-*l*N/A

        \[\leadsto \frac{t \cdot \left(-9 \cdot z\right)}{\color{blue}{a} \cdot 2} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{t \cdot \left(-9 \cdot z\right)}{a \cdot 2} \]
      14. lift-*.f64N/A

        \[\leadsto \frac{t \cdot \left(-9 \cdot z\right)}{a \cdot \color{blue}{2}} \]
      15. times-fracN/A

        \[\leadsto \frac{t}{a} \cdot \color{blue}{\frac{-9 \cdot z}{2}} \]
      16. lower-*.f64N/A

        \[\leadsto \frac{t}{a} \cdot \color{blue}{\frac{-9 \cdot z}{2}} \]
      17. lower-/.f64N/A

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

        \[\leadsto \frac{t}{a} \cdot \frac{-9 \cdot z}{2} \]
      19. associate-*l/N/A

        \[\leadsto \frac{t}{a} \cdot \left(\frac{-9}{2} \cdot \color{blue}{z}\right) \]
      20. metadata-evalN/A

        \[\leadsto \frac{t}{a} \cdot \left(\frac{-9}{2} \cdot z\right) \]
      21. lower-*.f6452.0

        \[\leadsto \frac{t}{a} \cdot \left(-4.5 \cdot \color{blue}{z}\right) \]
    6. Applied rewrites52.0%

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

    if -2.0000000000000001e276 < (*.f64 (*.f64 z #s(literal 9 binary64)) t) < -5.00000000000000024e-5

    1. Initial program 91.2%

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      2. sub-flipN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \mathsf{neg}\left(\color{blue}{\left(t \cdot z\right) \cdot 9}\right)\right)}{a \cdot 2} \]
      10. distribute-rgt-neg-inN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \color{blue}{\left(t \cdot z\right)} \cdot \left(\mathsf{neg}\left(9\right)\right)\right)}{a \cdot 2} \]
      13. metadata-eval91.5

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

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

    if -5.00000000000000024e-5 < (*.f64 (*.f64 z #s(literal 9 binary64)) t)

    1. Initial program 91.2%

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      3. sub-flipN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{\mathsf{neg}\left(\left(z \cdot 9\right) \cdot t\right)}{a} + \frac{y}{a} \cdot x}{2}} \]
    3. Applied rewrites88.1%

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

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

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

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

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

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\frac{y}{a} \cdot x + t \cdot \frac{-9 \cdot z}{a}\right)} \]
      6. distribute-rgt-outN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{y}{a}}{2} \cdot x + \frac{t \cdot \color{blue}{\frac{-9 \cdot z}{a}}}{2} \]
      14. associate-*r/N/A

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

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

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

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

        \[\leadsto \frac{\frac{y}{a}}{2} \cdot x + \frac{\frac{\color{blue}{\left(t \cdot z\right)} \cdot -9}{a}}{2} \]
      19. associate-/l/N/A

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

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

Alternative 5: 93.1% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;\left(z \cdot 9\right) \cdot t \leq -2 \cdot 10^{+276}:\\ \;\;\;\;\frac{t}{a} \cdot \left(-4.5 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t \cdot z\right) \cdot -9\right)}{a \cdot 2}\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= (* (* z 9.0) t) -2e+276)
   (* (/ t a) (* -4.5 z))
   (/ (fma y x (* (* t z) -9.0)) (* a 2.0))))
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 * 9.0) * t) <= -2e+276) {
		tmp = (t / a) * (-4.5 * z);
	} else {
		tmp = fma(y, x, ((t * z) * -9.0)) / (a * 2.0);
	}
	return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(Float64(z * 9.0) * t) <= -2e+276)
		tmp = Float64(Float64(t / a) * Float64(-4.5 * z));
	else
		tmp = Float64(fma(y, x, Float64(Float64(t * z) * -9.0)) / Float64(a * 2.0));
	end
	return tmp
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision], -2e+276], N[(N[(t / a), $MachinePrecision] * N[(-4.5 * z), $MachinePrecision]), $MachinePrecision], N[(N[(y * x + N[(N[(t * z), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(z \cdot 9\right) \cdot t \leq -2 \cdot 10^{+276}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-4.5 \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 z #s(literal 9 binary64)) t) < -2.0000000000000001e276

    1. Initial program 91.2%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{-9}{2} \cdot \frac{t \cdot z}{a}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      3. lower-*.f6451.5

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} \]
    4. Applied rewrites51.5%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. metadata-evalN/A

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

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      4. times-fracN/A

        \[\leadsto \frac{-9 \cdot \left(t \cdot z\right)}{\color{blue}{2 \cdot a}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-9 \cdot \left(t \cdot z\right)}{2 \cdot a} \]
      6. associate-*l*N/A

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{\color{blue}{2} \cdot a} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{2 \cdot a} \]
      8. *-commutativeN/A

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

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{a \cdot \color{blue}{2}} \]
      10. lift-*.f64N/A

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{a \cdot 2} \]
      11. *-commutativeN/A

        \[\leadsto \frac{\left(t \cdot -9\right) \cdot z}{a \cdot 2} \]
      12. associate-*l*N/A

        \[\leadsto \frac{t \cdot \left(-9 \cdot z\right)}{\color{blue}{a} \cdot 2} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{t \cdot \left(-9 \cdot z\right)}{a \cdot 2} \]
      14. lift-*.f64N/A

        \[\leadsto \frac{t \cdot \left(-9 \cdot z\right)}{a \cdot \color{blue}{2}} \]
      15. times-fracN/A

        \[\leadsto \frac{t}{a} \cdot \color{blue}{\frac{-9 \cdot z}{2}} \]
      16. lower-*.f64N/A

        \[\leadsto \frac{t}{a} \cdot \color{blue}{\frac{-9 \cdot z}{2}} \]
      17. lower-/.f64N/A

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

        \[\leadsto \frac{t}{a} \cdot \frac{-9 \cdot z}{2} \]
      19. associate-*l/N/A

        \[\leadsto \frac{t}{a} \cdot \left(\frac{-9}{2} \cdot \color{blue}{z}\right) \]
      20. metadata-evalN/A

        \[\leadsto \frac{t}{a} \cdot \left(\frac{-9}{2} \cdot z\right) \]
      21. lower-*.f6452.0

        \[\leadsto \frac{t}{a} \cdot \left(-4.5 \cdot \color{blue}{z}\right) \]
    6. Applied rewrites52.0%

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

    if -2.0000000000000001e276 < (*.f64 (*.f64 z #s(literal 9 binary64)) t)

    1. Initial program 91.2%

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      2. sub-flipN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \mathsf{neg}\left(\color{blue}{\left(t \cdot z\right) \cdot 9}\right)\right)}{a \cdot 2} \]
      10. distribute-rgt-neg-inN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \color{blue}{\left(t \cdot z\right)} \cdot \left(\mathsf{neg}\left(9\right)\right)\right)}{a \cdot 2} \]
      13. metadata-eval91.5

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

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

Alternative 6: 90.9% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;\left(z \cdot 9\right) \cdot t \leq -2 \cdot 10^{+276}:\\ \;\;\;\;\frac{t}{a} \cdot \left(-4.5 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(-9 \cdot t\right) \cdot z\right)}{a + a}\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= (* (* z 9.0) t) -2e+276)
   (* (/ t a) (* -4.5 z))
   (/ (fma y x (* (* -9.0 t) z)) (+ a 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 * 9.0) * t) <= -2e+276) {
		tmp = (t / a) * (-4.5 * z);
	} else {
		tmp = fma(y, x, ((-9.0 * t) * z)) / (a + a);
	}
	return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(Float64(z * 9.0) * t) <= -2e+276)
		tmp = Float64(Float64(t / a) * Float64(-4.5 * z));
	else
		tmp = Float64(fma(y, x, Float64(Float64(-9.0 * t) * z)) / Float64(a + a));
	end
	return tmp
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision], -2e+276], N[(N[(t / a), $MachinePrecision] * N[(-4.5 * z), $MachinePrecision]), $MachinePrecision], N[(N[(y * x + N[(N[(-9.0 * t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(z \cdot 9\right) \cdot t \leq -2 \cdot 10^{+276}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-4.5 \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 z #s(literal 9 binary64)) t) < -2.0000000000000001e276

    1. Initial program 91.2%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{-9}{2} \cdot \frac{t \cdot z}{a}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      3. lower-*.f6451.5

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} \]
    4. Applied rewrites51.5%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. metadata-evalN/A

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

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      4. times-fracN/A

        \[\leadsto \frac{-9 \cdot \left(t \cdot z\right)}{\color{blue}{2 \cdot a}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-9 \cdot \left(t \cdot z\right)}{2 \cdot a} \]
      6. associate-*l*N/A

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{\color{blue}{2} \cdot a} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{2 \cdot a} \]
      8. *-commutativeN/A

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

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{a \cdot \color{blue}{2}} \]
      10. lift-*.f64N/A

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{a \cdot 2} \]
      11. *-commutativeN/A

        \[\leadsto \frac{\left(t \cdot -9\right) \cdot z}{a \cdot 2} \]
      12. associate-*l*N/A

        \[\leadsto \frac{t \cdot \left(-9 \cdot z\right)}{\color{blue}{a} \cdot 2} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{t \cdot \left(-9 \cdot z\right)}{a \cdot 2} \]
      14. lift-*.f64N/A

        \[\leadsto \frac{t \cdot \left(-9 \cdot z\right)}{a \cdot \color{blue}{2}} \]
      15. times-fracN/A

        \[\leadsto \frac{t}{a} \cdot \color{blue}{\frac{-9 \cdot z}{2}} \]
      16. lower-*.f64N/A

        \[\leadsto \frac{t}{a} \cdot \color{blue}{\frac{-9 \cdot z}{2}} \]
      17. lower-/.f64N/A

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

        \[\leadsto \frac{t}{a} \cdot \frac{-9 \cdot z}{2} \]
      19. associate-*l/N/A

        \[\leadsto \frac{t}{a} \cdot \left(\frac{-9}{2} \cdot \color{blue}{z}\right) \]
      20. metadata-evalN/A

        \[\leadsto \frac{t}{a} \cdot \left(\frac{-9}{2} \cdot z\right) \]
      21. lower-*.f6452.0

        \[\leadsto \frac{t}{a} \cdot \left(-4.5 \cdot \color{blue}{z}\right) \]
    6. Applied rewrites52.0%

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

    if -2.0000000000000001e276 < (*.f64 (*.f64 z #s(literal 9 binary64)) t)

    1. Initial program 91.2%

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      2. sub-flipN/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{t \cdot z}, \mathsf{neg}\left(9\right), x \cdot y\right)}{a \cdot 2} \]
      11. metadata-eval91.3

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(t \cdot z, -9, y \cdot x\right)}{\color{blue}{a + a}} \]
      18. lower-+.f6491.3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 73.3% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := \left(z \cdot 9\right) \cdot t\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+59}:\\ \;\;\;\;\left(\frac{z}{a} \cdot -4.5\right) \cdot t\\ \mathbf{elif}\;t\_1 \leq 10^{+89}:\\ \;\;\;\;\frac{x \cdot y}{a + a}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{-4.5}{a} \cdot t\right) \cdot z\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* (* z 9.0) t)))
   (if (<= t_1 -2e+59)
     (* (* (/ z a) -4.5) t)
     (if (<= t_1 1e+89) (/ (* x y) (+ a a)) (* (* (/ -4.5 a) t) z)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (z * 9.0) * t;
	double tmp;
	if (t_1 <= -2e+59) {
		tmp = ((z / a) * -4.5) * t;
	} else if (t_1 <= 1e+89) {
		tmp = (x * y) / (a + a);
	} else {
		tmp = ((-4.5 / a) * t) * z;
	}
	return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z * 9.0d0) * t
    if (t_1 <= (-2d+59)) then
        tmp = ((z / a) * (-4.5d0)) * t
    else if (t_1 <= 1d+89) then
        tmp = (x * y) / (a + a)
    else
        tmp = (((-4.5d0) / a) * t) * z
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (z * 9.0) * t;
	double tmp;
	if (t_1 <= -2e+59) {
		tmp = ((z / a) * -4.5) * t;
	} else if (t_1 <= 1e+89) {
		tmp = (x * y) / (a + a);
	} else {
		tmp = ((-4.5 / a) * t) * z;
	}
	return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a])
def code(x, y, z, t, a):
	t_1 = (z * 9.0) * t
	tmp = 0
	if t_1 <= -2e+59:
		tmp = ((z / a) * -4.5) * t
	elif t_1 <= 1e+89:
		tmp = (x * y) / (a + a)
	else:
		tmp = ((-4.5 / a) * t) * z
	return tmp
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(z * 9.0) * t)
	tmp = 0.0
	if (t_1 <= -2e+59)
		tmp = Float64(Float64(Float64(z / a) * -4.5) * t);
	elseif (t_1 <= 1e+89)
		tmp = Float64(Float64(x * y) / Float64(a + a));
	else
		tmp = Float64(Float64(Float64(-4.5 / a) * t) * z);
	end
	return tmp
end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
	t_1 = (z * 9.0) * t;
	tmp = 0.0;
	if (t_1 <= -2e+59)
		tmp = ((z / a) * -4.5) * t;
	elseif (t_1 <= 1e+89)
		tmp = (x * y) / (a + a);
	else
		tmp = ((-4.5 / a) * t) * z;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+59], N[(N[(N[(z / a), $MachinePrecision] * -4.5), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 1e+89], N[(N[(x * y), $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-4.5 / a), $MachinePrecision] * t), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+59}:\\
\;\;\;\;\left(\frac{z}{a} \cdot -4.5\right) \cdot t\\

\mathbf{elif}\;t\_1 \leq 10^{+89}:\\
\;\;\;\;\frac{x \cdot y}{a + a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 z #s(literal 9 binary64)) t) < -1.99999999999999994e59

    1. Initial program 91.2%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{-9}{2} \cdot \frac{t \cdot z}{a}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      3. lower-*.f6451.5

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} \]
    4. Applied rewrites51.5%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. *-commutativeN/A

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

        \[\leadsto \frac{t \cdot z}{a} \cdot \frac{-9}{2} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{t \cdot z}{a} \cdot \frac{-9}{2} \]
      5. associate-/l*N/A

        \[\leadsto \left(t \cdot \frac{z}{a}\right) \cdot \frac{-9}{2} \]
      6. associate-*l*N/A

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

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

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

        \[\leadsto \left(\frac{z}{a} \cdot \frac{-9}{2}\right) \cdot t \]
      10. lower-/.f6452.3

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

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

    if -1.99999999999999994e59 < (*.f64 (*.f64 z #s(literal 9 binary64)) t) < 9.99999999999999995e88

    1. Initial program 91.2%

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      2. sub-flipN/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{t \cdot z}, \mathsf{neg}\left(9\right), x \cdot y\right)}{a \cdot 2} \]
      11. metadata-eval91.3

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(t \cdot z, -9, y \cdot x\right)}{\color{blue}{a + a}} \]
      18. lower-+.f6491.3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{x \cdot y}}{a + a} \]
    7. Step-by-step derivation
      1. lower-*.f6449.8

        \[\leadsto \frac{x \cdot \color{blue}{y}}{a + a} \]
    8. Applied rewrites49.8%

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

    if 9.99999999999999995e88 < (*.f64 (*.f64 z #s(literal 9 binary64)) t)

    1. Initial program 91.2%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{-9}{2} \cdot \frac{t \cdot z}{a}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      3. lower-*.f6451.5

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} \]
    4. Applied rewrites51.5%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. metadata-evalN/A

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

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      4. times-fracN/A

        \[\leadsto \frac{-9 \cdot \left(t \cdot z\right)}{\color{blue}{2 \cdot a}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-9 \cdot \left(t \cdot z\right)}{2 \cdot a} \]
      6. associate-*l*N/A

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{\color{blue}{2} \cdot a} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{2 \cdot a} \]
      8. *-commutativeN/A

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

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

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

        \[\leadsto z \cdot \color{blue}{\frac{-9 \cdot t}{a \cdot 2}} \]
      12. *-commutativeN/A

        \[\leadsto \frac{-9 \cdot t}{a \cdot 2} \cdot \color{blue}{z} \]
      13. lower-*.f64N/A

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

        \[\leadsto \frac{-9 \cdot t}{a \cdot 2} \cdot z \]
      15. *-commutativeN/A

        \[\leadsto \frac{t \cdot -9}{a \cdot 2} \cdot z \]
      16. lift-*.f64N/A

        \[\leadsto \frac{t \cdot -9}{a \cdot 2} \cdot z \]
      17. times-fracN/A

        \[\leadsto \left(\frac{t}{a} \cdot \frac{-9}{2}\right) \cdot z \]
      18. metadata-evalN/A

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

        \[\leadsto \left(\frac{t}{a} \cdot \frac{-9}{2}\right) \cdot z \]
      20. lower-/.f6452.1

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

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

        \[\leadsto \left(\frac{t}{a} \cdot \frac{-9}{2}\right) \cdot z \]
      2. lift-/.f64N/A

        \[\leadsto \left(\frac{t}{a} \cdot \frac{-9}{2}\right) \cdot z \]
      3. mult-flipN/A

        \[\leadsto \left(\left(t \cdot \frac{1}{a}\right) \cdot \frac{-9}{2}\right) \cdot z \]
      4. lift-/.f64N/A

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

        \[\leadsto \left(t \cdot \left(\frac{1}{a} \cdot \frac{-9}{2}\right)\right) \cdot z \]
      6. *-commutativeN/A

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

        \[\leadsto \left(\left(\frac{1}{a} \cdot \frac{-9}{2}\right) \cdot t\right) \cdot z \]
      8. *-commutativeN/A

        \[\leadsto \left(\left(\frac{-9}{2} \cdot \frac{1}{a}\right) \cdot t\right) \cdot z \]
      9. lift-/.f64N/A

        \[\leadsto \left(\left(\frac{-9}{2} \cdot \frac{1}{a}\right) \cdot t\right) \cdot z \]
      10. mult-flipN/A

        \[\leadsto \left(\frac{\frac{-9}{2}}{a} \cdot t\right) \cdot z \]
      11. lower-/.f6452.1

        \[\leadsto \left(\frac{-4.5}{a} \cdot t\right) \cdot z \]
    8. Applied rewrites52.1%

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

Alternative 8: 73.3% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := \left(z \cdot 9\right) \cdot t\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+59}:\\ \;\;\;\;-4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\ \mathbf{elif}\;t\_1 \leq 10^{+89}:\\ \;\;\;\;\frac{x \cdot y}{a + a}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{-4.5}{a} \cdot t\right) \cdot z\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* (* z 9.0) t)))
   (if (<= t_1 -2e+59)
     (* -4.5 (* (/ z a) t))
     (if (<= t_1 1e+89) (/ (* x y) (+ a a)) (* (* (/ -4.5 a) t) z)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (z * 9.0) * t;
	double tmp;
	if (t_1 <= -2e+59) {
		tmp = -4.5 * ((z / a) * t);
	} else if (t_1 <= 1e+89) {
		tmp = (x * y) / (a + a);
	} else {
		tmp = ((-4.5 / a) * t) * z;
	}
	return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z * 9.0d0) * t
    if (t_1 <= (-2d+59)) then
        tmp = (-4.5d0) * ((z / a) * t)
    else if (t_1 <= 1d+89) then
        tmp = (x * y) / (a + a)
    else
        tmp = (((-4.5d0) / a) * t) * z
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (z * 9.0) * t;
	double tmp;
	if (t_1 <= -2e+59) {
		tmp = -4.5 * ((z / a) * t);
	} else if (t_1 <= 1e+89) {
		tmp = (x * y) / (a + a);
	} else {
		tmp = ((-4.5 / a) * t) * z;
	}
	return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a])
def code(x, y, z, t, a):
	t_1 = (z * 9.0) * t
	tmp = 0
	if t_1 <= -2e+59:
		tmp = -4.5 * ((z / a) * t)
	elif t_1 <= 1e+89:
		tmp = (x * y) / (a + a)
	else:
		tmp = ((-4.5 / a) * t) * z
	return tmp
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(z * 9.0) * t)
	tmp = 0.0
	if (t_1 <= -2e+59)
		tmp = Float64(-4.5 * Float64(Float64(z / a) * t));
	elseif (t_1 <= 1e+89)
		tmp = Float64(Float64(x * y) / Float64(a + a));
	else
		tmp = Float64(Float64(Float64(-4.5 / a) * t) * z);
	end
	return tmp
end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
	t_1 = (z * 9.0) * t;
	tmp = 0.0;
	if (t_1 <= -2e+59)
		tmp = -4.5 * ((z / a) * t);
	elseif (t_1 <= 1e+89)
		tmp = (x * y) / (a + a);
	else
		tmp = ((-4.5 / a) * t) * z;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+59], N[(-4.5 * N[(N[(z / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+89], N[(N[(x * y), $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-4.5 / a), $MachinePrecision] * t), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+59}:\\
\;\;\;\;-4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\

\mathbf{elif}\;t\_1 \leq 10^{+89}:\\
\;\;\;\;\frac{x \cdot y}{a + a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 z #s(literal 9 binary64)) t) < -1.99999999999999994e59

    1. Initial program 91.2%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{-9}{2} \cdot \frac{t \cdot z}{a}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      3. lower-*.f6451.5

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} \]
    4. Applied rewrites51.5%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{a} \]
      3. associate-/l*N/A

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

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

        \[\leadsto \frac{-9}{2} \cdot \left(\frac{z}{a} \cdot \color{blue}{t}\right) \]
      6. lower-/.f6452.3

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

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

    if -1.99999999999999994e59 < (*.f64 (*.f64 z #s(literal 9 binary64)) t) < 9.99999999999999995e88

    1. Initial program 91.2%

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      2. sub-flipN/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{t \cdot z}, \mathsf{neg}\left(9\right), x \cdot y\right)}{a \cdot 2} \]
      11. metadata-eval91.3

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(t \cdot z, -9, y \cdot x\right)}{\color{blue}{a + a}} \]
      18. lower-+.f6491.3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{x \cdot y}}{a + a} \]
    7. Step-by-step derivation
      1. lower-*.f6449.8

        \[\leadsto \frac{x \cdot \color{blue}{y}}{a + a} \]
    8. Applied rewrites49.8%

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

    if 9.99999999999999995e88 < (*.f64 (*.f64 z #s(literal 9 binary64)) t)

    1. Initial program 91.2%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{-9}{2} \cdot \frac{t \cdot z}{a}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      3. lower-*.f6451.5

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} \]
    4. Applied rewrites51.5%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. metadata-evalN/A

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

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      4. times-fracN/A

        \[\leadsto \frac{-9 \cdot \left(t \cdot z\right)}{\color{blue}{2 \cdot a}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{-9 \cdot \left(t \cdot z\right)}{2 \cdot a} \]
      6. associate-*l*N/A

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{\color{blue}{2} \cdot a} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\left(-9 \cdot t\right) \cdot z}{2 \cdot a} \]
      8. *-commutativeN/A

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

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

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

        \[\leadsto z \cdot \color{blue}{\frac{-9 \cdot t}{a \cdot 2}} \]
      12. *-commutativeN/A

        \[\leadsto \frac{-9 \cdot t}{a \cdot 2} \cdot \color{blue}{z} \]
      13. lower-*.f64N/A

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

        \[\leadsto \frac{-9 \cdot t}{a \cdot 2} \cdot z \]
      15. *-commutativeN/A

        \[\leadsto \frac{t \cdot -9}{a \cdot 2} \cdot z \]
      16. lift-*.f64N/A

        \[\leadsto \frac{t \cdot -9}{a \cdot 2} \cdot z \]
      17. times-fracN/A

        \[\leadsto \left(\frac{t}{a} \cdot \frac{-9}{2}\right) \cdot z \]
      18. metadata-evalN/A

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

        \[\leadsto \left(\frac{t}{a} \cdot \frac{-9}{2}\right) \cdot z \]
      20. lower-/.f6452.1

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

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

        \[\leadsto \left(\frac{t}{a} \cdot \frac{-9}{2}\right) \cdot z \]
      2. lift-/.f64N/A

        \[\leadsto \left(\frac{t}{a} \cdot \frac{-9}{2}\right) \cdot z \]
      3. mult-flipN/A

        \[\leadsto \left(\left(t \cdot \frac{1}{a}\right) \cdot \frac{-9}{2}\right) \cdot z \]
      4. lift-/.f64N/A

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

        \[\leadsto \left(t \cdot \left(\frac{1}{a} \cdot \frac{-9}{2}\right)\right) \cdot z \]
      6. *-commutativeN/A

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

        \[\leadsto \left(\left(\frac{1}{a} \cdot \frac{-9}{2}\right) \cdot t\right) \cdot z \]
      8. *-commutativeN/A

        \[\leadsto \left(\left(\frac{-9}{2} \cdot \frac{1}{a}\right) \cdot t\right) \cdot z \]
      9. lift-/.f64N/A

        \[\leadsto \left(\left(\frac{-9}{2} \cdot \frac{1}{a}\right) \cdot t\right) \cdot z \]
      10. mult-flipN/A

        \[\leadsto \left(\frac{\frac{-9}{2}}{a} \cdot t\right) \cdot z \]
      11. lower-/.f6452.1

        \[\leadsto \left(\frac{-4.5}{a} \cdot t\right) \cdot z \]
    8. Applied rewrites52.1%

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

Alternative 9: 73.3% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := \left(z \cdot 9\right) \cdot t\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+59}:\\ \;\;\;\;-4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\ \mathbf{elif}\;t\_1 \leq 10^{+89}:\\ \;\;\;\;\frac{x \cdot y}{a + a}\\ \mathbf{else}:\\ \;\;\;\;-4.5 \cdot \left(\frac{t}{a} \cdot z\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* (* z 9.0) t)))
   (if (<= t_1 -2e+59)
     (* -4.5 (* (/ z a) t))
     (if (<= t_1 1e+89) (/ (* x y) (+ a a)) (* -4.5 (* (/ t a) z))))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (z * 9.0) * t;
	double tmp;
	if (t_1 <= -2e+59) {
		tmp = -4.5 * ((z / a) * t);
	} else if (t_1 <= 1e+89) {
		tmp = (x * y) / (a + a);
	} else {
		tmp = -4.5 * ((t / a) * z);
	}
	return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z * 9.0d0) * t
    if (t_1 <= (-2d+59)) then
        tmp = (-4.5d0) * ((z / a) * t)
    else if (t_1 <= 1d+89) then
        tmp = (x * y) / (a + a)
    else
        tmp = (-4.5d0) * ((t / a) * z)
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (z * 9.0) * t;
	double tmp;
	if (t_1 <= -2e+59) {
		tmp = -4.5 * ((z / a) * t);
	} else if (t_1 <= 1e+89) {
		tmp = (x * y) / (a + a);
	} else {
		tmp = -4.5 * ((t / a) * z);
	}
	return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a])
def code(x, y, z, t, a):
	t_1 = (z * 9.0) * t
	tmp = 0
	if t_1 <= -2e+59:
		tmp = -4.5 * ((z / a) * t)
	elif t_1 <= 1e+89:
		tmp = (x * y) / (a + a)
	else:
		tmp = -4.5 * ((t / a) * z)
	return tmp
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(z * 9.0) * t)
	tmp = 0.0
	if (t_1 <= -2e+59)
		tmp = Float64(-4.5 * Float64(Float64(z / a) * t));
	elseif (t_1 <= 1e+89)
		tmp = Float64(Float64(x * y) / Float64(a + a));
	else
		tmp = Float64(-4.5 * Float64(Float64(t / a) * z));
	end
	return tmp
end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
	t_1 = (z * 9.0) * t;
	tmp = 0.0;
	if (t_1 <= -2e+59)
		tmp = -4.5 * ((z / a) * t);
	elseif (t_1 <= 1e+89)
		tmp = (x * y) / (a + a);
	else
		tmp = -4.5 * ((t / a) * z);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+59], N[(-4.5 * N[(N[(z / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+89], N[(N[(x * y), $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+59}:\\
\;\;\;\;-4.5 \cdot \left(\frac{z}{a} \cdot t\right)\\

\mathbf{elif}\;t\_1 \leq 10^{+89}:\\
\;\;\;\;\frac{x \cdot y}{a + a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 z #s(literal 9 binary64)) t) < -1.99999999999999994e59

    1. Initial program 91.2%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{-9}{2} \cdot \frac{t \cdot z}{a}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      3. lower-*.f6451.5

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} \]
    4. Applied rewrites51.5%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{a} \]
      3. associate-/l*N/A

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

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

        \[\leadsto \frac{-9}{2} \cdot \left(\frac{z}{a} \cdot \color{blue}{t}\right) \]
      6. lower-/.f6452.3

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

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

    if -1.99999999999999994e59 < (*.f64 (*.f64 z #s(literal 9 binary64)) t) < 9.99999999999999995e88

    1. Initial program 91.2%

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      2. sub-flipN/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{t \cdot z}, \mathsf{neg}\left(9\right), x \cdot y\right)}{a \cdot 2} \]
      11. metadata-eval91.3

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(t \cdot z, -9, y \cdot x\right)}{\color{blue}{a + a}} \]
      18. lower-+.f6491.3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{x \cdot y}}{a + a} \]
    7. Step-by-step derivation
      1. lower-*.f6449.8

        \[\leadsto \frac{x \cdot \color{blue}{y}}{a + a} \]
    8. Applied rewrites49.8%

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

    if 9.99999999999999995e88 < (*.f64 (*.f64 z #s(literal 9 binary64)) t)

    1. Initial program 91.2%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{-9}{2} \cdot \frac{t \cdot z}{a}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      3. lower-*.f6451.5

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} \]
    4. Applied rewrites51.5%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{a} \]
      3. *-commutativeN/A

        \[\leadsto \frac{-9}{2} \cdot \frac{z \cdot t}{a} \]
      4. associate-/l*N/A

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

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

        \[\leadsto \frac{-9}{2} \cdot \left(\frac{t}{a} \cdot \color{blue}{z}\right) \]
      7. lower-/.f6452.1

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

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

Alternative 10: 73.1% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := \left(z \cdot 9\right) \cdot t\\ t_2 := -4.5 \cdot \left(\frac{t}{a} \cdot z\right)\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+59}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 10^{+89}:\\ \;\;\;\;\frac{x \cdot y}{a + a}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* (* z 9.0) t)) (t_2 (* -4.5 (* (/ t a) z))))
   (if (<= t_1 -2e+59) t_2 (if (<= t_1 1e+89) (/ (* x y) (+ a a)) t_2))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (z * 9.0) * t;
	double t_2 = -4.5 * ((t / a) * z);
	double tmp;
	if (t_1 <= -2e+59) {
		tmp = t_2;
	} else if (t_1 <= 1e+89) {
		tmp = (x * y) / (a + a);
	} else {
		tmp = t_2;
	}
	return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (z * 9.0d0) * t
    t_2 = (-4.5d0) * ((t / a) * z)
    if (t_1 <= (-2d+59)) then
        tmp = t_2
    else if (t_1 <= 1d+89) then
        tmp = (x * y) / (a + a)
    else
        tmp = t_2
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (z * 9.0) * t;
	double t_2 = -4.5 * ((t / a) * z);
	double tmp;
	if (t_1 <= -2e+59) {
		tmp = t_2;
	} else if (t_1 <= 1e+89) {
		tmp = (x * y) / (a + a);
	} else {
		tmp = t_2;
	}
	return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a])
def code(x, y, z, t, a):
	t_1 = (z * 9.0) * t
	t_2 = -4.5 * ((t / a) * z)
	tmp = 0
	if t_1 <= -2e+59:
		tmp = t_2
	elif t_1 <= 1e+89:
		tmp = (x * y) / (a + a)
	else:
		tmp = t_2
	return tmp
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(z * 9.0) * t)
	t_2 = Float64(-4.5 * Float64(Float64(t / a) * z))
	tmp = 0.0
	if (t_1 <= -2e+59)
		tmp = t_2;
	elseif (t_1 <= 1e+89)
		tmp = Float64(Float64(x * y) / Float64(a + a));
	else
		tmp = t_2;
	end
	return tmp
end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
	t_1 = (z * 9.0) * t;
	t_2 = -4.5 * ((t / a) * z);
	tmp = 0.0;
	if (t_1 <= -2e+59)
		tmp = t_2;
	elseif (t_1 <= 1e+89)
		tmp = (x * y) / (a + a);
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(-4.5 * N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+59], t$95$2, If[LessEqual[t$95$1, 1e+89], N[(N[(x * y), $MachinePrecision] / N[(a + a), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot 9\right) \cdot t\\
t_2 := -4.5 \cdot \left(\frac{t}{a} \cdot z\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+59}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 10^{+89}:\\
\;\;\;\;\frac{x \cdot y}{a + a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 z #s(literal 9 binary64)) t) < -1.99999999999999994e59 or 9.99999999999999995e88 < (*.f64 (*.f64 z #s(literal 9 binary64)) t)

    1. Initial program 91.2%

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2} \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{-9}{2} \cdot \frac{t \cdot z}{a}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \color{blue}{\frac{t \cdot z}{a}} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{\color{blue}{a}} \]
      3. lower-*.f6451.5

        \[\leadsto -4.5 \cdot \frac{t \cdot z}{a} \]
    4. Applied rewrites51.5%

      \[\leadsto \color{blue}{-4.5 \cdot \frac{t \cdot z}{a}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \frac{-9}{2} \cdot \frac{t \cdot z}{a} \]
      3. *-commutativeN/A

        \[\leadsto \frac{-9}{2} \cdot \frac{z \cdot t}{a} \]
      4. associate-/l*N/A

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

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

        \[\leadsto \frac{-9}{2} \cdot \left(\frac{t}{a} \cdot \color{blue}{z}\right) \]
      7. lower-/.f6452.1

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

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

    if -1.99999999999999994e59 < (*.f64 (*.f64 z #s(literal 9 binary64)) t) < 9.99999999999999995e88

    1. Initial program 91.2%

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

        \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
      2. sub-flipN/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{t \cdot z}, \mathsf{neg}\left(9\right), x \cdot y\right)}{a \cdot 2} \]
      11. metadata-eval91.3

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(t \cdot z, -9, y \cdot x\right)}{\color{blue}{a + a}} \]
      18. lower-+.f6491.3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{x \cdot y}}{a + a} \]
    7. Step-by-step derivation
      1. lower-*.f6449.8

        \[\leadsto \frac{x \cdot \color{blue}{y}}{a + a} \]
    8. Applied rewrites49.8%

      \[\leadsto \frac{\color{blue}{x \cdot y}}{a + a} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 49.8% accurate, 1.9× speedup?

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

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

      \[\leadsto \frac{\color{blue}{x \cdot y - \left(z \cdot 9\right) \cdot t}}{a \cdot 2} \]
    2. sub-flipN/A

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{t \cdot z}, \mathsf{neg}\left(9\right), x \cdot y\right)}{a \cdot 2} \]
    11. metadata-eval91.3

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(t \cdot z, -9, y \cdot x\right)}{\color{blue}{a + a}} \]
    18. lower-+.f6491.3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{x \cdot y}}{a + a} \]
  7. Step-by-step derivation
    1. lower-*.f6449.8

      \[\leadsto \frac{x \cdot \color{blue}{y}}{a + a} \]
  8. Applied rewrites49.8%

    \[\leadsto \frac{\color{blue}{x \cdot y}}{a + a} \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2025154 
(FPCore (x y z t a)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, I"
  :precision binary64
  (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))