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

Percentage Accurate: 91.2% → 96.6%
Time: 4.0s
Alternatives: 6
Speedup: N/A×

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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 6 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: 96.6% accurate, N/A× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t \cdot -9}{2}, \frac{z}{a}, \frac{y}{2} \cdot \frac{x}{a}\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)) < -5.0000000000000005e251

    1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000000005e251 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < 5.0000000000000002e220

    1. Initial program 97.2%

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

      \[\leadsto \frac{\color{blue}{x \cdot y - 9 \cdot \left(t \cdot z\right)}}{a \cdot 2} \]
    4. Step-by-step derivation
      1. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 71.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-9 \cdot t}{2} \cdot \frac{z}{a}} + \frac{\frac{y \cdot x}{a}}{2} \]
    6. Applied rewrites91.4%

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

Alternative 2: 95.0% accurate, N/A× speedup?

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

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

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


\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)) < -5.0000000000000005e251

    1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000000005e251 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < 9.9999999999999998e284

    1. Initial program 97.3%

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

      \[\leadsto \frac{\color{blue}{x \cdot y - 9 \cdot \left(t \cdot z\right)}}{a \cdot 2} \]
    4. Step-by-step derivation
      1. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 66.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{x}{a}, \frac{-1}{2}, \frac{\frac{t \cdot z}{a}}{y} \cdot \frac{9}{2}\right) \cdot y\right) \cdot -1 \]
      13. lower-*.f6490.1

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

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

Alternative 3: 94.3% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\ [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := \left(\mathsf{fma}\left(\frac{x}{a}, -0.5, \frac{\frac{t \cdot z}{a}}{y} \cdot 4.5\right) \cdot y\right) \cdot -1\\ \mathbf{if}\;x \cdot y \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+278}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-9 \cdot z, t, y \cdot x\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.
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 (/ x a) -0.5 (* (/ (/ (* t z) a) y) 4.5)) y) -1.0)))
   (if (<= (* x y) (- INFINITY))
     t_1
     (if (<= (* x y) 4e+278) (/ (fma (* -9.0 z) t (* y x)) (* a 2.0)) t_1))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (fma((x / a), -0.5, ((((t * z) / a) / y) * 4.5)) * y) * -1.0;
	double tmp;
	if ((x * y) <= -((double) INFINITY)) {
		tmp = t_1;
	} else if ((x * y) <= 4e+278) {
		tmp = fma((-9.0 * z), t, (y * x)) / (a * 2.0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a])
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(fma(Float64(x / a), -0.5, Float64(Float64(Float64(Float64(t * z) / a) / y) * 4.5)) * y) * -1.0)
	tmp = 0.0
	if (Float64(x * y) <= Float64(-Inf))
		tmp = t_1;
	elseif (Float64(x * y) <= 4e+278)
		tmp = Float64(fma(Float64(-9.0 * z), t, Float64(y * x)) / 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.
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[(N[(N[(x / a), $MachinePrecision] * -0.5 + N[(N[(N[(N[(t * z), $MachinePrecision] / a), $MachinePrecision] / y), $MachinePrecision] * 4.5), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] * -1.0), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4e+278], N[(N[(N[(-9.0 * z), $MachinePrecision] * t + N[(y * x), $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])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \left(\mathsf{fma}\left(\frac{x}{a}, -0.5, \frac{\frac{t \cdot z}{a}}{y} \cdot 4.5\right) \cdot y\right) \cdot -1\\
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;t\_1\\

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

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


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

    1. Initial program 54.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{x}{a}, -0.5, \frac{\frac{t \cdot z}{a}}{y} \cdot 4.5\right) \cdot y\right) \cdot -1 \]
    5. Applied rewrites97.0%

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

    if -inf.0 < (*.f64 x y) < 3.99999999999999985e278

    1. Initial program 94.3%

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

      \[\leadsto \frac{\color{blue}{x \cdot y - 9 \cdot \left(t \cdot z\right)}}{a \cdot 2} \]
    4. Step-by-step derivation
      1. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

Alternative 4: 92.9% accurate, N/A× speedup?

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

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

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


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

    1. Initial program 58.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{x}{a}, \frac{-1}{2}, \frac{\frac{t \cdot z}{a}}{y} \cdot \frac{9}{2}\right) \cdot y\right) \cdot -1 \]
      13. lower-*.f6497.3

        \[\leadsto \left(\mathsf{fma}\left(\frac{x}{a}, -0.5, \frac{\frac{t \cdot z}{a}}{y} \cdot 4.5\right) \cdot y\right) \cdot -1 \]
    5. Applied rewrites97.3%

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

    if -inf.0 < (*.f64 x y) < 1.9999999999999999e211

    1. Initial program 94.2%

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

      \[\leadsto \color{blue}{\frac{-9}{2} \cdot \frac{t \cdot z}{a} + \frac{1}{2} \cdot \frac{x \cdot y}{a}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y \cdot x}{a}, \frac{1}{2}, \frac{t \cdot z}{a} \cdot \frac{-9}{2}\right) \]
      10. lower-*.f6493.3

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

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

Alternative 5: 87.8% accurate, N/A× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -4.9999999999999996e22 or 1.00000000000000005e96 < (*.f64 x y)

    1. Initial program 80.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{x}{a}, \frac{-1}{2}, \frac{\frac{t \cdot z}{a}}{y} \cdot \frac{9}{2}\right) \cdot y\right) \cdot -1 \]
      13. lower-*.f6487.6

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

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

    if -4.9999999999999996e22 < (*.f64 x y) < 1.00000000000000005e96

    1. Initial program 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 82.8% accurate, N/A× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\ [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \left(\mathsf{fma}\left(\frac{x}{a}, -0.5, \frac{\frac{t \cdot z}{a}}{y} \cdot 4.5\right) \cdot y\right) \cdot -1 \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (* (* (fma (/ x a) -0.5 (* (/ (/ (* t z) a) y) 4.5)) y) -1.0))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	return (fma((x / a), -0.5, ((((t * z) / a) / y) * 4.5)) * y) * -1.0;
}
x, y, z, t, a = sort([x, y, z, t, a])
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	return Float64(Float64(fma(Float64(x / a), -0.5, Float64(Float64(Float64(Float64(t * z) / a) / y) * 4.5)) * y) * -1.0)
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[(x / a), $MachinePrecision] * -0.5 + N[(N[(N[(N[(t * z), $MachinePrecision] / a), $MachinePrecision] / y), $MachinePrecision] * 4.5), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] * -1.0), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\left(\mathsf{fma}\left(\frac{x}{a}, -0.5, \frac{\frac{t \cdot z}{a}}{y} \cdot 4.5\right) \cdot y\right) \cdot -1
\end{array}
Derivation
  1. Initial program 88.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\mathsf{fma}\left(\frac{x}{a}, \frac{-1}{2}, \frac{\frac{t \cdot z}{a}}{y} \cdot \frac{9}{2}\right) \cdot y\right) \cdot -1 \]
    13. lower-*.f6484.5

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

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\frac{x}{a}, -0.5, \frac{\frac{t \cdot z}{a}}{y} \cdot 4.5\right) \cdot y\right) \cdot -1} \]
  6. Add Preprocessing

Reproduce

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

  :alt
  (! :herbie-platform default (if (< a -209046455797670900000000000000000000000000000000000000000000000000000000000000000000000) (- (* 1/2 (/ (* y x) a)) (* 9/2 (/ t (/ a z)))) (if (< a 2144030707833976000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z (* 9 t))) (* a 2)) (- (* (/ y a) (* x 1/2)) (* (/ t a) (* z 9/2))))))

  (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))