Data.Colour.Matrix:determinant from colour-2.3.3, A

Percentage Accurate: 73.5% → 82.3%
Time: 7.4s
Alternatives: 13
Speedup: 0.5×

Specification

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

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

real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8), intent (in) :: j
    code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
def code(x, y, z, t, a, b, c, i, j):
	return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
function code(x, y, z, t, a, b, c, i, j)
	return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i))))
end
function tmp = code(x, y, z, t, a, b, c, i, j)
	tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\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 13 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: 73.5% accurate, 1.0× speedup?

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

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

real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8), intent (in) :: j
    code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
def code(x, y, z, t, a, b, c, i, j):
	return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
function code(x, y, z, t, a, b, c, i, j)
	return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i))))
end
function tmp = code(x, y, z, t, a, b, c, i, j)
	tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\end{array}

Alternative 1: 82.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{if}\;t\_1 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1
         (+
          (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i))))
          (* j (- (* c a) (* y i))))))
   (if (<= t_1 INFINITY) t_1 (* (- i) (fma j y (* (- b) t))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = -i * fma(j, y, (-b * t));
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i))))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(Float64(-i) * fma(j, y, Float64(Float64(-b) * t)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[((-i) * N[(j * y + N[((-b) * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right)\\


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

    1. Initial program 93.6%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing

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

    1. Initial program 0.0%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in i around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \left(j \cdot y - b \cdot t\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot i\right) \cdot \color{blue}{\left(j \cdot y - b \cdot t\right)} \]
      2. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(i\right)\right) \cdot \left(\color{blue}{j \cdot y} - b \cdot t\right) \]
      3. lower-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(i\right)\right) \cdot \color{blue}{\left(j \cdot y - b \cdot t\right)} \]
      4. lower-neg.f64N/A

        \[\leadsto \left(-i\right) \cdot \left(\color{blue}{j \cdot y} - b \cdot t\right) \]
      5. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(-i\right) \cdot \left(j \cdot y + \color{blue}{\left(\mathsf{neg}\left(b\right)\right) \cdot t}\right) \]
      6. lower-fma.f64N/A

        \[\leadsto \left(-i\right) \cdot \mathsf{fma}\left(j, \color{blue}{y}, \left(\mathsf{neg}\left(b\right)\right) \cdot t\right) \]
      7. lower-*.f64N/A

        \[\leadsto \left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(\mathsf{neg}\left(b\right)\right) \cdot t\right) \]
      8. lower-neg.f6462.0

        \[\leadsto \left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right) \]
    5. Applied rewrites62.0%

      \[\leadsto \color{blue}{\left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 52.1% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right)\\ \mathbf{if}\;i \leq -6.8 \cdot 10^{+140}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;i \leq -5.4 \cdot 10^{+50}:\\ \;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\ \mathbf{elif}\;i \leq -8.2 \cdot 10^{-208}:\\ \;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\ \mathbf{elif}\;i \leq -1.9 \cdot 10^{-267}:\\ \;\;\;\;\mathsf{fma}\left(-t, x, j \cdot c\right) \cdot a\\ \mathbf{elif}\;i \leq 3 \cdot 10^{-8}:\\ \;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* (- i) (fma j y (* (- b) t)))))
   (if (<= i -6.8e+140)
     t_1
     (if (<= i -5.4e+50)
       (* (fma (- i) y (* c a)) j)
       (if (<= i -8.2e-208)
         (* (fma y x (* (- b) c)) z)
         (if (<= i -1.9e-267)
           (* (fma (- t) x (* j c)) a)
           (if (<= i 3e-8) (* (fma (- a) t (* z y)) x) t_1)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = -i * fma(j, y, (-b * t));
	double tmp;
	if (i <= -6.8e+140) {
		tmp = t_1;
	} else if (i <= -5.4e+50) {
		tmp = fma(-i, y, (c * a)) * j;
	} else if (i <= -8.2e-208) {
		tmp = fma(y, x, (-b * c)) * z;
	} else if (i <= -1.9e-267) {
		tmp = fma(-t, x, (j * c)) * a;
	} else if (i <= 3e-8) {
		tmp = fma(-a, t, (z * y)) * x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(Float64(-i) * fma(j, y, Float64(Float64(-b) * t)))
	tmp = 0.0
	if (i <= -6.8e+140)
		tmp = t_1;
	elseif (i <= -5.4e+50)
		tmp = Float64(fma(Float64(-i), y, Float64(c * a)) * j);
	elseif (i <= -8.2e-208)
		tmp = Float64(fma(y, x, Float64(Float64(-b) * c)) * z);
	elseif (i <= -1.9e-267)
		tmp = Float64(fma(Float64(-t), x, Float64(j * c)) * a);
	elseif (i <= 3e-8)
		tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[((-i) * N[(j * y + N[((-b) * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -6.8e+140], t$95$1, If[LessEqual[i, -5.4e+50], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[i, -8.2e-208], N[(N[(y * x + N[((-b) * c), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[i, -1.9e-267], N[(N[((-t) * x + N[(j * c), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[i, 3e-8], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right)\\
\mathbf{if}\;i \leq -6.8 \cdot 10^{+140}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;i \leq -5.4 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\

\mathbf{elif}\;i \leq -8.2 \cdot 10^{-208}:\\
\;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\

\mathbf{elif}\;i \leq -1.9 \cdot 10^{-267}:\\
\;\;\;\;\mathsf{fma}\left(-t, x, j \cdot c\right) \cdot a\\

\mathbf{elif}\;i \leq 3 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if i < -6.8e140 or 2.99999999999999973e-8 < i

    1. Initial program 58.7%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in i around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \left(j \cdot y - b \cdot t\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot i\right) \cdot \color{blue}{\left(j \cdot y - b \cdot t\right)} \]
      2. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(i\right)\right) \cdot \left(\color{blue}{j \cdot y} - b \cdot t\right) \]
      3. lower-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(i\right)\right) \cdot \color{blue}{\left(j \cdot y - b \cdot t\right)} \]
      4. lower-neg.f64N/A

        \[\leadsto \left(-i\right) \cdot \left(\color{blue}{j \cdot y} - b \cdot t\right) \]
      5. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(-i\right) \cdot \left(j \cdot y + \color{blue}{\left(\mathsf{neg}\left(b\right)\right) \cdot t}\right) \]
      6. lower-fma.f64N/A

        \[\leadsto \left(-i\right) \cdot \mathsf{fma}\left(j, \color{blue}{y}, \left(\mathsf{neg}\left(b\right)\right) \cdot t\right) \]
      7. lower-*.f64N/A

        \[\leadsto \left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(\mathsf{neg}\left(b\right)\right) \cdot t\right) \]
      8. lower-neg.f6473.0

        \[\leadsto \left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right) \]
    5. Applied rewrites73.0%

      \[\leadsto \color{blue}{\left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right)} \]

    if -6.8e140 < i < -5.4e50

    1. Initial program 86.7%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in j around inf

      \[\leadsto \color{blue}{j \cdot \left(a \cdot c - i \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot \color{blue}{j} \]
      2. *-commutativeN/A

        \[\leadsto \left(c \cdot a - i \cdot y\right) \cdot j \]
      3. *-commutativeN/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot j \]
      4. lower-*.f64N/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot \color{blue}{j} \]
      5. *-commutativeN/A

        \[\leadsto \left(a \cdot c - y \cdot i\right) \cdot j \]
      6. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot j \]
      7. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(a \cdot c + \left(\mathsf{neg}\left(i\right)\right) \cdot y\right) \cdot j \]
      8. mul-1-negN/A

        \[\leadsto \left(a \cdot c + \left(-1 \cdot i\right) \cdot y\right) \cdot j \]
      9. associate-*r*N/A

        \[\leadsto \left(a \cdot c + -1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      10. +-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right) + a \cdot c\right) \cdot j \]
      11. associate-*r*N/A

        \[\leadsto \left(\left(-1 \cdot i\right) \cdot y + a \cdot c\right) \cdot j \]
      12. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot y + a \cdot c\right) \cdot j \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), y, a \cdot c\right) \cdot j \]
      14. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(-i, y, a \cdot c\right) \cdot j \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
      16. lift-*.f6477.5

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
    5. Applied rewrites77.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j} \]

    if -5.4e50 < i < -8.1999999999999998e-208

    1. Initial program 85.1%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{z \cdot \left(x \cdot y - b \cdot c\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(x \cdot y + \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      4. *-commutativeN/A

        \[\leadsto \left(y \cdot x + \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(y, x, \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, x, \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      7. lower-neg.f6468.6

        \[\leadsto \mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z \]
    5. Applied rewrites68.6%

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

    if -8.1999999999999998e-208 < i < -1.90000000000000001e-267

    1. Initial program 86.5%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in a around inf

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

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

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

        \[\leadsto \left(\left(-1 \cdot t\right) \cdot x + c \cdot j\right) \cdot a \]
      4. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t\right)\right) \cdot x + c \cdot j\right) \cdot a \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(t\right), x, c \cdot j\right) \cdot a \]
      6. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(-t, x, c \cdot j\right) \cdot a \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-t, x, j \cdot c\right) \cdot a \]
      8. lower-*.f6479.3

        \[\leadsto \mathsf{fma}\left(-t, x, j \cdot c\right) \cdot a \]
    5. Applied rewrites79.3%

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

    if -1.90000000000000001e-267 < i < 2.99999999999999973e-8

    1. Initial program 90.1%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

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

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

        \[\leadsto \left(y \cdot z - t \cdot a\right) \cdot x \]
      3. lower-*.f64N/A

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

        \[\leadsto \left(y \cdot z - a \cdot t\right) \cdot x \]
      5. fp-cancel-sub-sign-invN/A

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

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

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

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

        \[\leadsto \left(\left(-1 \cdot a\right) \cdot t + y \cdot z\right) \cdot x \]
      10. mul-1-negN/A

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

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

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

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

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

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

Alternative 3: 63.8% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -6.5 \cdot 10^{+170} \lor \neg \left(i \leq 5.9 \cdot 10^{-8}\right):\\ \;\;\;\;\left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (if (or (<= i -6.5e+170) (not (<= i 5.9e-8)))
   (* (- i) (fma j y (* (- b) t)))
   (fma (fma (- i) y (* c a)) j (* (fma (- a) t (* z y)) x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double tmp;
	if ((i <= -6.5e+170) || !(i <= 5.9e-8)) {
		tmp = -i * fma(j, y, (-b * t));
	} else {
		tmp = fma(fma(-i, y, (c * a)), j, (fma(-a, t, (z * y)) * x));
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j)
	tmp = 0.0
	if ((i <= -6.5e+170) || !(i <= 5.9e-8))
		tmp = Float64(Float64(-i) * fma(j, y, Float64(Float64(-b) * t)));
	else
		tmp = fma(fma(Float64(-i), y, Float64(c * a)), j, Float64(fma(Float64(-a), t, Float64(z * y)) * x));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[i, -6.5e+170], N[Not[LessEqual[i, 5.9e-8]], $MachinePrecision]], N[((-i) * N[(j * y + N[((-b) * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j + N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq -6.5 \cdot 10^{+170} \lor \neg \left(i \leq 5.9 \cdot 10^{-8}\right):\\
\;\;\;\;\left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -6.5e170 or 5.8999999999999999e-8 < i

    1. Initial program 58.5%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in i around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \left(j \cdot y - b \cdot t\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot i\right) \cdot \color{blue}{\left(j \cdot y - b \cdot t\right)} \]
      2. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(i\right)\right) \cdot \left(\color{blue}{j \cdot y} - b \cdot t\right) \]
      3. lower-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(i\right)\right) \cdot \color{blue}{\left(j \cdot y - b \cdot t\right)} \]
      4. lower-neg.f64N/A

        \[\leadsto \left(-i\right) \cdot \left(\color{blue}{j \cdot y} - b \cdot t\right) \]
      5. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(-i\right) \cdot \left(j \cdot y + \color{blue}{\left(\mathsf{neg}\left(b\right)\right) \cdot t}\right) \]
      6. lower-fma.f64N/A

        \[\leadsto \left(-i\right) \cdot \mathsf{fma}\left(j, \color{blue}{y}, \left(\mathsf{neg}\left(b\right)\right) \cdot t\right) \]
      7. lower-*.f64N/A

        \[\leadsto \left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(\mathsf{neg}\left(b\right)\right) \cdot t\right) \]
      8. lower-neg.f6473.7

        \[\leadsto \left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right) \]
    5. Applied rewrites73.7%

      \[\leadsto \color{blue}{\left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right)} \]

    if -6.5e170 < i < 5.8999999999999999e-8

    1. Initial program 87.1%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in b around 0

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

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

        \[\leadsto \left(c \cdot a - i \cdot y\right) \cdot j + x \cdot \left(y \cdot z - a \cdot t\right) \]
      3. *-commutativeN/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot j + x \cdot \left(y \cdot z - a \cdot t\right) \]
      4. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(a \cdot c - y \cdot i, j, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a \cdot c - i \cdot y, j, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      7. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(a \cdot c + \left(\mathsf{neg}\left(i\right)\right) \cdot y, j, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      8. mul-1-negN/A

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

        \[\leadsto \mathsf{fma}\left(a \cdot c + -1 \cdot \left(i \cdot y\right), j, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-1 \cdot \left(i \cdot y\right) + a \cdot c, j, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      11. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(\left(-1 \cdot i\right) \cdot y + a \cdot c, j, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\left(\mathsf{neg}\left(i\right)\right) \cdot y + a \cdot c, j, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      13. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-i, y, a \cdot c\right), j, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      16. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      17. *-commutativeN/A

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -6.5 \cdot 10^{+170} \lor \neg \left(i \leq 5.9 \cdot 10^{-8}\right):\\ \;\;\;\;\left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-i, y, c \cdot a\right), j, \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 52.0% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\ t_2 := \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\ \mathbf{if}\;j \leq -1.4 \cdot 10^{+65}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;j \leq -9.2 \cdot 10^{-122}:\\ \;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\ \mathbf{elif}\;j \leq -7.3 \cdot 10^{-298}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;j \leq 1.2 \cdot 10^{-194}:\\ \;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\ \mathbf{elif}\;j \leq 9 \cdot 10^{+27}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* (fma i t (* (- c) z)) b)) (t_2 (* (fma (- i) y (* c a)) j)))
   (if (<= j -1.4e+65)
     t_2
     (if (<= j -9.2e-122)
       (* (fma (- i) j (* z x)) y)
       (if (<= j -7.3e-298)
         t_1
         (if (<= j 1.2e-194)
           (* (fma (- a) t (* z y)) x)
           (if (<= j 9e+27) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = fma(i, t, (-c * z)) * b;
	double t_2 = fma(-i, y, (c * a)) * j;
	double tmp;
	if (j <= -1.4e+65) {
		tmp = t_2;
	} else if (j <= -9.2e-122) {
		tmp = fma(-i, j, (z * x)) * y;
	} else if (j <= -7.3e-298) {
		tmp = t_1;
	} else if (j <= 1.2e-194) {
		tmp = fma(-a, t, (z * y)) * x;
	} else if (j <= 9e+27) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(fma(i, t, Float64(Float64(-c) * z)) * b)
	t_2 = Float64(fma(Float64(-i), y, Float64(c * a)) * j)
	tmp = 0.0
	if (j <= -1.4e+65)
		tmp = t_2;
	elseif (j <= -9.2e-122)
		tmp = Float64(fma(Float64(-i), j, Float64(z * x)) * y);
	elseif (j <= -7.3e-298)
		tmp = t_1;
	elseif (j <= 1.2e-194)
		tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x);
	elseif (j <= 9e+27)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-i) * y + N[(c * a), $MachinePrecision]), $MachinePrecision] * j), $MachinePrecision]}, If[LessEqual[j, -1.4e+65], t$95$2, If[LessEqual[j, -9.2e-122], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[j, -7.3e-298], t$95$1, If[LessEqual[j, 1.2e-194], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[j, 9e+27], t$95$1, t$95$2]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\
t_2 := \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j\\
\mathbf{if}\;j \leq -1.4 \cdot 10^{+65}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;j \leq -9.2 \cdot 10^{-122}:\\
\;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\

\mathbf{elif}\;j \leq -7.3 \cdot 10^{-298}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;j \leq 1.2 \cdot 10^{-194}:\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\

\mathbf{elif}\;j \leq 9 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if j < -1.3999999999999999e65 or 8.9999999999999998e27 < j

    1. Initial program 77.8%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in j around inf

      \[\leadsto \color{blue}{j \cdot \left(a \cdot c - i \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot \color{blue}{j} \]
      2. *-commutativeN/A

        \[\leadsto \left(c \cdot a - i \cdot y\right) \cdot j \]
      3. *-commutativeN/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot j \]
      4. lower-*.f64N/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot \color{blue}{j} \]
      5. *-commutativeN/A

        \[\leadsto \left(a \cdot c - y \cdot i\right) \cdot j \]
      6. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot j \]
      7. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(a \cdot c + \left(\mathsf{neg}\left(i\right)\right) \cdot y\right) \cdot j \]
      8. mul-1-negN/A

        \[\leadsto \left(a \cdot c + \left(-1 \cdot i\right) \cdot y\right) \cdot j \]
      9. associate-*r*N/A

        \[\leadsto \left(a \cdot c + -1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      10. +-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right) + a \cdot c\right) \cdot j \]
      11. associate-*r*N/A

        \[\leadsto \left(\left(-1 \cdot i\right) \cdot y + a \cdot c\right) \cdot j \]
      12. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot y + a \cdot c\right) \cdot j \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), y, a \cdot c\right) \cdot j \]
      14. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(-i, y, a \cdot c\right) \cdot j \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
      16. lift-*.f6470.5

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
    5. Applied rewrites70.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j} \]

    if -1.3999999999999999e65 < j < -9.20000000000000028e-122

    1. Initial program 78.5%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

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

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

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

        \[\leadsto \left(\left(-1 \cdot i\right) \cdot j + x \cdot z\right) \cdot y \]
      4. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot j + x \cdot z\right) \cdot y \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), j, x \cdot z\right) \cdot y \]
      6. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(-i, j, x \cdot z\right) \cdot y \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y \]
      8. lower-*.f6452.9

        \[\leadsto \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y \]
    5. Applied rewrites52.9%

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

    if -9.20000000000000028e-122 < j < -7.3000000000000003e-298 or 1.2e-194 < j < 8.9999999999999998e27

    1. Initial program 78.8%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf

      \[\leadsto \color{blue}{b \cdot \left(i \cdot t - c \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(i \cdot t + \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      8. lower-neg.f6457.0

        \[\leadsto \mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b \]
    5. Applied rewrites57.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b} \]

    if -7.3000000000000003e-298 < j < 1.2e-194

    1. Initial program 61.0%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

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

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

        \[\leadsto \left(y \cdot z - t \cdot a\right) \cdot x \]
      3. lower-*.f64N/A

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

        \[\leadsto \left(y \cdot z - a \cdot t\right) \cdot x \]
      5. fp-cancel-sub-sign-invN/A

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

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

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

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

        \[\leadsto \left(\left(-1 \cdot a\right) \cdot t + y \cdot z\right) \cdot x \]
      10. mul-1-negN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x \]
      14. lower-*.f6471.4

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

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

Alternative 5: 59.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+17} \lor \neg \left(z \leq 5.4 \cdot 10^{+86}\right):\\ \;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\left(i \cdot t\right) \cdot b + j \cdot \left(c \cdot a - y \cdot i\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (if (or (<= z -5.5e+17) (not (<= z 5.4e+86)))
   (* (fma y x (* (- b) c)) z)
   (+ (* (* i t) b) (* j (- (* c a) (* y i))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double tmp;
	if ((z <= -5.5e+17) || !(z <= 5.4e+86)) {
		tmp = fma(y, x, (-b * c)) * z;
	} else {
		tmp = ((i * t) * b) + (j * ((c * a) - (y * i)));
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j)
	tmp = 0.0
	if ((z <= -5.5e+17) || !(z <= 5.4e+86))
		tmp = Float64(fma(y, x, Float64(Float64(-b) * c)) * z);
	else
		tmp = Float64(Float64(Float64(i * t) * b) + Float64(j * Float64(Float64(c * a) - Float64(y * i))));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[z, -5.5e+17], N[Not[LessEqual[z, 5.4e+86]], $MachinePrecision]], N[(N[(y * x + N[((-b) * c), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+17} \lor \neg \left(z \leq 5.4 \cdot 10^{+86}\right):\\
\;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\

\mathbf{else}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b + j \cdot \left(c \cdot a - y \cdot i\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.5e17 or 5.40000000000000036e86 < z

    1. Initial program 72.2%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{z \cdot \left(x \cdot y - b \cdot c\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(x \cdot y + \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      4. *-commutativeN/A

        \[\leadsto \left(y \cdot x + \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(y, x, \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, x, \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      7. lower-neg.f6469.4

        \[\leadsto \mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z \]
    5. Applied rewrites69.4%

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

    if -5.5e17 < z < 5.40000000000000036e86

    1. Initial program 79.2%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in i around inf

      \[\leadsto \color{blue}{b \cdot \left(i \cdot t\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(i \cdot t\right) \cdot \color{blue}{b} + j \cdot \left(c \cdot a - y \cdot i\right) \]
      3. lower-*.f6462.2

        \[\leadsto \left(i \cdot t\right) \cdot b + j \cdot \left(c \cdot a - y \cdot i\right) \]
    5. Applied rewrites62.2%

      \[\leadsto \color{blue}{\left(i \cdot t\right) \cdot b} + j \cdot \left(c \cdot a - y \cdot i\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+17} \lor \neg \left(z \leq 5.4 \cdot 10^{+86}\right):\\ \;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\left(i \cdot t\right) \cdot b + j \cdot \left(c \cdot a - y \cdot i\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 29.0% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot \left(c \cdot j\right)\\ t_2 := \left(i \cdot t\right) \cdot b\\ \mathbf{if}\;i \leq -3.8 \cdot 10^{+164}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;i \leq -8.5 \cdot 10^{+67}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;i \leq 2.4 \cdot 10^{-128}:\\ \;\;\;\;\left(y \cdot x\right) \cdot z\\ \mathbf{elif}\;i \leq 3.2 \cdot 10^{-7}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* a (* c j))) (t_2 (* (* i t) b)))
   (if (<= i -3.8e+164)
     t_2
     (if (<= i -8.5e+67)
       t_1
       (if (<= i 2.4e-128) (* (* y x) z) (if (<= i 3.2e-7) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = a * (c * j);
	double t_2 = (i * t) * b;
	double tmp;
	if (i <= -3.8e+164) {
		tmp = t_2;
	} else if (i <= -8.5e+67) {
		tmp = t_1;
	} else if (i <= 2.4e-128) {
		tmp = (y * x) * z;
	} else if (i <= 3.2e-7) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8), intent (in) :: j
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = a * (c * j)
    t_2 = (i * t) * b
    if (i <= (-3.8d+164)) then
        tmp = t_2
    else if (i <= (-8.5d+67)) then
        tmp = t_1
    else if (i <= 2.4d-128) then
        tmp = (y * x) * z
    else if (i <= 3.2d-7) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = a * (c * j);
	double t_2 = (i * t) * b;
	double tmp;
	if (i <= -3.8e+164) {
		tmp = t_2;
	} else if (i <= -8.5e+67) {
		tmp = t_1;
	} else if (i <= 2.4e-128) {
		tmp = (y * x) * z;
	} else if (i <= 3.2e-7) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j):
	t_1 = a * (c * j)
	t_2 = (i * t) * b
	tmp = 0
	if i <= -3.8e+164:
		tmp = t_2
	elif i <= -8.5e+67:
		tmp = t_1
	elif i <= 2.4e-128:
		tmp = (y * x) * z
	elif i <= 3.2e-7:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(a * Float64(c * j))
	t_2 = Float64(Float64(i * t) * b)
	tmp = 0.0
	if (i <= -3.8e+164)
		tmp = t_2;
	elseif (i <= -8.5e+67)
		tmp = t_1;
	elseif (i <= 2.4e-128)
		tmp = Float64(Float64(y * x) * z);
	elseif (i <= 3.2e-7)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j)
	t_1 = a * (c * j);
	t_2 = (i * t) * b;
	tmp = 0.0;
	if (i <= -3.8e+164)
		tmp = t_2;
	elseif (i <= -8.5e+67)
		tmp = t_1;
	elseif (i <= 2.4e-128)
		tmp = (y * x) * z;
	elseif (i <= 3.2e-7)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(a * N[(c * j), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[i, -3.8e+164], t$95$2, If[LessEqual[i, -8.5e+67], t$95$1, If[LessEqual[i, 2.4e-128], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[i, 3.2e-7], t$95$1, t$95$2]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot \left(c \cdot j\right)\\
t_2 := \left(i \cdot t\right) \cdot b\\
\mathbf{if}\;i \leq -3.8 \cdot 10^{+164}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;i \leq -8.5 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;i \leq 2.4 \cdot 10^{-128}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\

\mathbf{elif}\;i \leq 3.2 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if i < -3.80000000000000021e164 or 3.2000000000000001e-7 < i

    1. Initial program 58.5%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf

      \[\leadsto \color{blue}{b \cdot \left(i \cdot t - c \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(i \cdot t + \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      8. lower-neg.f6453.3

        \[\leadsto \mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b \]
    5. Applied rewrites53.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b} \]
    6. Taylor expanded in z around 0

      \[\leadsto \left(i \cdot t\right) \cdot b \]
    7. Step-by-step derivation
      1. lower-*.f6443.0

        \[\leadsto \left(i \cdot t\right) \cdot b \]
    8. Applied rewrites43.0%

      \[\leadsto \left(i \cdot t\right) \cdot b \]

    if -3.80000000000000021e164 < i < -8.50000000000000038e67 or 2.3999999999999998e-128 < i < 3.2000000000000001e-7

    1. Initial program 85.5%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in j around inf

      \[\leadsto \color{blue}{j \cdot \left(a \cdot c - i \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot \color{blue}{j} \]
      2. *-commutativeN/A

        \[\leadsto \left(c \cdot a - i \cdot y\right) \cdot j \]
      3. *-commutativeN/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot j \]
      4. lower-*.f64N/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot \color{blue}{j} \]
      5. *-commutativeN/A

        \[\leadsto \left(a \cdot c - y \cdot i\right) \cdot j \]
      6. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot j \]
      7. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(a \cdot c + \left(\mathsf{neg}\left(i\right)\right) \cdot y\right) \cdot j \]
      8. mul-1-negN/A

        \[\leadsto \left(a \cdot c + \left(-1 \cdot i\right) \cdot y\right) \cdot j \]
      9. associate-*r*N/A

        \[\leadsto \left(a \cdot c + -1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      10. +-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right) + a \cdot c\right) \cdot j \]
      11. associate-*r*N/A

        \[\leadsto \left(\left(-1 \cdot i\right) \cdot y + a \cdot c\right) \cdot j \]
      12. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot y + a \cdot c\right) \cdot j \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), y, a \cdot c\right) \cdot j \]
      14. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(-i, y, a \cdot c\right) \cdot j \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
      16. lift-*.f6451.0

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
    5. Applied rewrites51.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j} \]
    6. Taylor expanded in y around 0

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

        \[\leadsto a \cdot \left(c \cdot \color{blue}{j}\right) \]
      2. lower-*.f6446.5

        \[\leadsto a \cdot \left(c \cdot j\right) \]
    8. Applied rewrites46.5%

      \[\leadsto a \cdot \color{blue}{\left(c \cdot j\right)} \]

    if -8.50000000000000038e67 < i < 2.3999999999999998e-128

    1. Initial program 87.8%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{z \cdot \left(x \cdot y - b \cdot c\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(x \cdot y + \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      4. *-commutativeN/A

        \[\leadsto \left(y \cdot x + \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(y, x, \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, x, \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      7. lower-neg.f6456.2

        \[\leadsto \mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z \]
    5. Applied rewrites56.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z} \]
    6. Taylor expanded in x around inf

      \[\leadsto \left(x \cdot y\right) \cdot z \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(y \cdot x\right) \cdot z \]
      2. lower-*.f6437.2

        \[\leadsto \left(y \cdot x\right) \cdot z \]
    8. Applied rewrites37.2%

      \[\leadsto \left(y \cdot x\right) \cdot z \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 7: 51.8% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.36 \cdot 10^{-38} \lor \neg \left(y \leq 58000000000000\right):\\ \;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (if (or (<= y -1.36e-38) (not (<= y 58000000000000.0)))
   (* (fma (- i) j (* z x)) y)
   (* (fma i t (* (- c) z)) b)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double tmp;
	if ((y <= -1.36e-38) || !(y <= 58000000000000.0)) {
		tmp = fma(-i, j, (z * x)) * y;
	} else {
		tmp = fma(i, t, (-c * z)) * b;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j)
	tmp = 0.0
	if ((y <= -1.36e-38) || !(y <= 58000000000000.0))
		tmp = Float64(fma(Float64(-i), j, Float64(z * x)) * y);
	else
		tmp = Float64(fma(i, t, Float64(Float64(-c) * z)) * b);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[y, -1.36e-38], N[Not[LessEqual[y, 58000000000000.0]], $MachinePrecision]], N[(N[((-i) * j + N[(z * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.36 \cdot 10^{-38} \lor \neg \left(y \leq 58000000000000\right):\\
\;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.36e-38 or 5.8e13 < y

    1. Initial program 69.2%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

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

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

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

        \[\leadsto \left(\left(-1 \cdot i\right) \cdot j + x \cdot z\right) \cdot y \]
      4. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot j + x \cdot z\right) \cdot y \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), j, x \cdot z\right) \cdot y \]
      6. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(-i, j, x \cdot z\right) \cdot y \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y \]
      8. lower-*.f6459.9

        \[\leadsto \mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y \]
    5. Applied rewrites59.9%

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

    if -1.36e-38 < y < 5.8e13

    1. Initial program 85.2%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf

      \[\leadsto \color{blue}{b \cdot \left(i \cdot t - c \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(i \cdot t + \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      8. lower-neg.f6453.5

        \[\leadsto \mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b \]
    5. Applied rewrites53.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.36 \cdot 10^{-38} \lor \neg \left(y \leq 58000000000000\right):\\ \;\;\;\;\mathsf{fma}\left(-i, j, z \cdot x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 52.8% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{-13} \lor \neg \left(x \leq 5 \cdot 10^{-36}\right):\\ \;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (if (or (<= x -1.15e-13) (not (<= x 5e-36)))
   (* (fma (- a) t (* z y)) x)
   (* (fma i t (* (- c) z)) b)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double tmp;
	if ((x <= -1.15e-13) || !(x <= 5e-36)) {
		tmp = fma(-a, t, (z * y)) * x;
	} else {
		tmp = fma(i, t, (-c * z)) * b;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j)
	tmp = 0.0
	if ((x <= -1.15e-13) || !(x <= 5e-36))
		tmp = Float64(fma(Float64(-a), t, Float64(z * y)) * x);
	else
		tmp = Float64(fma(i, t, Float64(Float64(-c) * z)) * b);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[x, -1.15e-13], N[Not[LessEqual[x, 5e-36]], $MachinePrecision]], N[(N[((-a) * t + N[(z * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{-13} \lor \neg \left(x \leq 5 \cdot 10^{-36}\right):\\
\;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.1499999999999999e-13 or 5.00000000000000004e-36 < x

    1. Initial program 78.7%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

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

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

        \[\leadsto \left(y \cdot z - t \cdot a\right) \cdot x \]
      3. lower-*.f64N/A

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

        \[\leadsto \left(y \cdot z - a \cdot t\right) \cdot x \]
      5. fp-cancel-sub-sign-invN/A

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

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

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

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

        \[\leadsto \left(\left(-1 \cdot a\right) \cdot t + y \cdot z\right) \cdot x \]
      10. mul-1-negN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x \]
      14. lower-*.f6461.7

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

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

    if -1.1499999999999999e-13 < x < 5.00000000000000004e-36

    1. Initial program 73.6%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf

      \[\leadsto \color{blue}{b \cdot \left(i \cdot t - c \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(i \cdot t + \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      8. lower-neg.f6449.8

        \[\leadsto \mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b \]
    5. Applied rewrites49.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification56.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{-13} \lor \neg \left(x \leq 5 \cdot 10^{-36}\right):\\ \;\;\;\;\mathsf{fma}\left(-a, t, z \cdot y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 44.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -2.8 \cdot 10^{+52}:\\ \;\;\;\;\left(\left(-i\right) \cdot y\right) \cdot j\\ \mathbf{elif}\;i \leq 3.5 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (if (<= i -2.8e+52)
   (* (* (- i) y) j)
   (if (<= i 3.5e-7) (* (fma y x (* (- b) c)) z) (* (fma i t (* (- c) z)) b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double tmp;
	if (i <= -2.8e+52) {
		tmp = (-i * y) * j;
	} else if (i <= 3.5e-7) {
		tmp = fma(y, x, (-b * c)) * z;
	} else {
		tmp = fma(i, t, (-c * z)) * b;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j)
	tmp = 0.0
	if (i <= -2.8e+52)
		tmp = Float64(Float64(Float64(-i) * y) * j);
	elseif (i <= 3.5e-7)
		tmp = Float64(fma(y, x, Float64(Float64(-b) * c)) * z);
	else
		tmp = Float64(fma(i, t, Float64(Float64(-c) * z)) * b);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[i, -2.8e+52], N[(N[((-i) * y), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[i, 3.5e-7], N[(N[(y * x + N[((-b) * c), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.8 \cdot 10^{+52}:\\
\;\;\;\;\left(\left(-i\right) \cdot y\right) \cdot j\\

\mathbf{elif}\;i \leq 3.5 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if i < -2.8e52

    1. Initial program 61.2%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in j around inf

      \[\leadsto \color{blue}{j \cdot \left(a \cdot c - i \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot \color{blue}{j} \]
      2. *-commutativeN/A

        \[\leadsto \left(c \cdot a - i \cdot y\right) \cdot j \]
      3. *-commutativeN/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot j \]
      4. lower-*.f64N/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot \color{blue}{j} \]
      5. *-commutativeN/A

        \[\leadsto \left(a \cdot c - y \cdot i\right) \cdot j \]
      6. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot j \]
      7. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(a \cdot c + \left(\mathsf{neg}\left(i\right)\right) \cdot y\right) \cdot j \]
      8. mul-1-negN/A

        \[\leadsto \left(a \cdot c + \left(-1 \cdot i\right) \cdot y\right) \cdot j \]
      9. associate-*r*N/A

        \[\leadsto \left(a \cdot c + -1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      10. +-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right) + a \cdot c\right) \cdot j \]
      11. associate-*r*N/A

        \[\leadsto \left(\left(-1 \cdot i\right) \cdot y + a \cdot c\right) \cdot j \]
      12. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot y + a \cdot c\right) \cdot j \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), y, a \cdot c\right) \cdot j \]
      14. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(-i, y, a \cdot c\right) \cdot j \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
      16. lift-*.f6455.4

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
    5. Applied rewrites55.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j} \]
    6. Taylor expanded in y around inf

      \[\leadsto \left(-1 \cdot \left(i \cdot y\right)\right) \cdot j \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      2. lower-*.f6444.6

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right)\right) \cdot j \]
    8. Applied rewrites44.6%

      \[\leadsto \left(-1 \cdot \left(i \cdot y\right)\right) \cdot j \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      2. lift-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      3. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(i \cdot y\right)\right) \cdot j \]
      4. distribute-lft-neg-outN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot y\right) \cdot j \]
      5. lower-*.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot y\right) \cdot j \]
      6. lift-neg.f6444.6

        \[\leadsto \left(\left(-i\right) \cdot y\right) \cdot j \]
    10. Applied rewrites44.6%

      \[\leadsto \color{blue}{\left(\left(-i\right) \cdot y\right) \cdot j} \]

    if -2.8e52 < i < 3.49999999999999984e-7

    1. Initial program 88.2%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{z \cdot \left(x \cdot y - b \cdot c\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(x \cdot y + \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      4. *-commutativeN/A

        \[\leadsto \left(y \cdot x + \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(y, x, \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, x, \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      7. lower-neg.f6454.4

        \[\leadsto \mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z \]
    5. Applied rewrites54.4%

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

    if 3.49999999999999984e-7 < i

    1. Initial program 62.6%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf

      \[\leadsto \color{blue}{b \cdot \left(i \cdot t - c \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(i \cdot t + \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      8. lower-neg.f6457.3

        \[\leadsto \mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b \]
    5. Applied rewrites57.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 10: 41.5% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;j \leq -1.35 \cdot 10^{+72}:\\ \;\;\;\;\left(a \cdot c\right) \cdot j\\ \mathbf{elif}\;j \leq 1.15 \cdot 10^{+28}:\\ \;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(-i\right) \cdot \left(j \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (if (<= j -1.35e+72)
   (* (* a c) j)
   (if (<= j 1.15e+28) (* (fma i t (* (- c) z)) b) (* (- i) (* j y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double tmp;
	if (j <= -1.35e+72) {
		tmp = (a * c) * j;
	} else if (j <= 1.15e+28) {
		tmp = fma(i, t, (-c * z)) * b;
	} else {
		tmp = -i * (j * y);
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j)
	tmp = 0.0
	if (j <= -1.35e+72)
		tmp = Float64(Float64(a * c) * j);
	elseif (j <= 1.15e+28)
		tmp = Float64(fma(i, t, Float64(Float64(-c) * z)) * b);
	else
		tmp = Float64(Float64(-i) * Float64(j * y));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[j, -1.35e+72], N[(N[(a * c), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[j, 1.15e+28], N[(N[(i * t + N[((-c) * z), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[((-i) * N[(j * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;j \leq -1.35 \cdot 10^{+72}:\\
\;\;\;\;\left(a \cdot c\right) \cdot j\\

\mathbf{elif}\;j \leq 1.15 \cdot 10^{+28}:\\
\;\;\;\;\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b\\

\mathbf{else}:\\
\;\;\;\;\left(-i\right) \cdot \left(j \cdot y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if j < -1.35e72

    1. Initial program 75.0%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in j around inf

      \[\leadsto \color{blue}{j \cdot \left(a \cdot c - i \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot \color{blue}{j} \]
      2. *-commutativeN/A

        \[\leadsto \left(c \cdot a - i \cdot y\right) \cdot j \]
      3. *-commutativeN/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot j \]
      4. lower-*.f64N/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot \color{blue}{j} \]
      5. *-commutativeN/A

        \[\leadsto \left(a \cdot c - y \cdot i\right) \cdot j \]
      6. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot j \]
      7. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(a \cdot c + \left(\mathsf{neg}\left(i\right)\right) \cdot y\right) \cdot j \]
      8. mul-1-negN/A

        \[\leadsto \left(a \cdot c + \left(-1 \cdot i\right) \cdot y\right) \cdot j \]
      9. associate-*r*N/A

        \[\leadsto \left(a \cdot c + -1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      10. +-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right) + a \cdot c\right) \cdot j \]
      11. associate-*r*N/A

        \[\leadsto \left(\left(-1 \cdot i\right) \cdot y + a \cdot c\right) \cdot j \]
      12. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot y + a \cdot c\right) \cdot j \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), y, a \cdot c\right) \cdot j \]
      14. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(-i, y, a \cdot c\right) \cdot j \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
      16. lift-*.f6469.9

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
    5. Applied rewrites69.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j} \]
    6. Taylor expanded in y around 0

      \[\leadsto \left(a \cdot c\right) \cdot j \]
    7. Step-by-step derivation
      1. lower-*.f6450.5

        \[\leadsto \left(a \cdot c\right) \cdot j \]
    8. Applied rewrites50.5%

      \[\leadsto \left(a \cdot c\right) \cdot j \]

    if -1.35e72 < j < 1.14999999999999992e28

    1. Initial program 75.4%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf

      \[\leadsto \color{blue}{b \cdot \left(i \cdot t - c \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(i \cdot t + \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      8. lower-neg.f6447.2

        \[\leadsto \mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b \]
    5. Applied rewrites47.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b} \]

    if 1.14999999999999992e28 < j

    1. Initial program 80.0%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in i around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \left(j \cdot y - b \cdot t\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-1 \cdot i\right) \cdot \color{blue}{\left(j \cdot y - b \cdot t\right)} \]
      2. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(i\right)\right) \cdot \left(\color{blue}{j \cdot y} - b \cdot t\right) \]
      3. lower-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(i\right)\right) \cdot \color{blue}{\left(j \cdot y - b \cdot t\right)} \]
      4. lower-neg.f64N/A

        \[\leadsto \left(-i\right) \cdot \left(\color{blue}{j \cdot y} - b \cdot t\right) \]
      5. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(-i\right) \cdot \left(j \cdot y + \color{blue}{\left(\mathsf{neg}\left(b\right)\right) \cdot t}\right) \]
      6. lower-fma.f64N/A

        \[\leadsto \left(-i\right) \cdot \mathsf{fma}\left(j, \color{blue}{y}, \left(\mathsf{neg}\left(b\right)\right) \cdot t\right) \]
      7. lower-*.f64N/A

        \[\leadsto \left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(\mathsf{neg}\left(b\right)\right) \cdot t\right) \]
      8. lower-neg.f6456.0

        \[\leadsto \left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right) \]
    5. Applied rewrites56.0%

      \[\leadsto \color{blue}{\left(-i\right) \cdot \mathsf{fma}\left(j, y, \left(-b\right) \cdot t\right)} \]
    6. Taylor expanded in y around inf

      \[\leadsto \left(-i\right) \cdot \left(j \cdot \color{blue}{y}\right) \]
    7. Step-by-step derivation
      1. lower-*.f6446.2

        \[\leadsto \left(-i\right) \cdot \left(j \cdot y\right) \]
    8. Applied rewrites46.2%

      \[\leadsto \left(-i\right) \cdot \left(j \cdot \color{blue}{y}\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 11: 30.3% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -5.4 \cdot 10^{+50}:\\ \;\;\;\;\left(\left(-i\right) \cdot y\right) \cdot j\\ \mathbf{elif}\;i \leq 2.4 \cdot 10^{-128}:\\ \;\;\;\;\left(y \cdot x\right) \cdot z\\ \mathbf{elif}\;i \leq 3.2 \cdot 10^{-7}:\\ \;\;\;\;a \cdot \left(c \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;\left(i \cdot t\right) \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (if (<= i -5.4e+50)
   (* (* (- i) y) j)
   (if (<= i 2.4e-128)
     (* (* y x) z)
     (if (<= i 3.2e-7) (* a (* c j)) (* (* i t) b)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double tmp;
	if (i <= -5.4e+50) {
		tmp = (-i * y) * j;
	} else if (i <= 2.4e-128) {
		tmp = (y * x) * z;
	} else if (i <= 3.2e-7) {
		tmp = a * (c * j);
	} else {
		tmp = (i * t) * b;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8), intent (in) :: j
    real(8) :: tmp
    if (i <= (-5.4d+50)) then
        tmp = (-i * y) * j
    else if (i <= 2.4d-128) then
        tmp = (y * x) * z
    else if (i <= 3.2d-7) then
        tmp = a * (c * j)
    else
        tmp = (i * t) * b
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double tmp;
	if (i <= -5.4e+50) {
		tmp = (-i * y) * j;
	} else if (i <= 2.4e-128) {
		tmp = (y * x) * z;
	} else if (i <= 3.2e-7) {
		tmp = a * (c * j);
	} else {
		tmp = (i * t) * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j):
	tmp = 0
	if i <= -5.4e+50:
		tmp = (-i * y) * j
	elif i <= 2.4e-128:
		tmp = (y * x) * z
	elif i <= 3.2e-7:
		tmp = a * (c * j)
	else:
		tmp = (i * t) * b
	return tmp
function code(x, y, z, t, a, b, c, i, j)
	tmp = 0.0
	if (i <= -5.4e+50)
		tmp = Float64(Float64(Float64(-i) * y) * j);
	elseif (i <= 2.4e-128)
		tmp = Float64(Float64(y * x) * z);
	elseif (i <= 3.2e-7)
		tmp = Float64(a * Float64(c * j));
	else
		tmp = Float64(Float64(i * t) * b);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j)
	tmp = 0.0;
	if (i <= -5.4e+50)
		tmp = (-i * y) * j;
	elseif (i <= 2.4e-128)
		tmp = (y * x) * z;
	elseif (i <= 3.2e-7)
		tmp = a * (c * j);
	else
		tmp = (i * t) * b;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[LessEqual[i, -5.4e+50], N[(N[((-i) * y), $MachinePrecision] * j), $MachinePrecision], If[LessEqual[i, 2.4e-128], N[(N[(y * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[i, 3.2e-7], N[(a * N[(c * j), $MachinePrecision]), $MachinePrecision], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq -5.4 \cdot 10^{+50}:\\
\;\;\;\;\left(\left(-i\right) \cdot y\right) \cdot j\\

\mathbf{elif}\;i \leq 2.4 \cdot 10^{-128}:\\
\;\;\;\;\left(y \cdot x\right) \cdot z\\

\mathbf{elif}\;i \leq 3.2 \cdot 10^{-7}:\\
\;\;\;\;a \cdot \left(c \cdot j\right)\\

\mathbf{else}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if i < -5.4e50

    1. Initial program 61.2%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in j around inf

      \[\leadsto \color{blue}{j \cdot \left(a \cdot c - i \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot \color{blue}{j} \]
      2. *-commutativeN/A

        \[\leadsto \left(c \cdot a - i \cdot y\right) \cdot j \]
      3. *-commutativeN/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot j \]
      4. lower-*.f64N/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot \color{blue}{j} \]
      5. *-commutativeN/A

        \[\leadsto \left(a \cdot c - y \cdot i\right) \cdot j \]
      6. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot j \]
      7. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(a \cdot c + \left(\mathsf{neg}\left(i\right)\right) \cdot y\right) \cdot j \]
      8. mul-1-negN/A

        \[\leadsto \left(a \cdot c + \left(-1 \cdot i\right) \cdot y\right) \cdot j \]
      9. associate-*r*N/A

        \[\leadsto \left(a \cdot c + -1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      10. +-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right) + a \cdot c\right) \cdot j \]
      11. associate-*r*N/A

        \[\leadsto \left(\left(-1 \cdot i\right) \cdot y + a \cdot c\right) \cdot j \]
      12. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot y + a \cdot c\right) \cdot j \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), y, a \cdot c\right) \cdot j \]
      14. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(-i, y, a \cdot c\right) \cdot j \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
      16. lift-*.f6455.4

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
    5. Applied rewrites55.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j} \]
    6. Taylor expanded in y around inf

      \[\leadsto \left(-1 \cdot \left(i \cdot y\right)\right) \cdot j \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      2. lower-*.f6444.6

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right)\right) \cdot j \]
    8. Applied rewrites44.6%

      \[\leadsto \left(-1 \cdot \left(i \cdot y\right)\right) \cdot j \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      2. lift-*.f64N/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      3. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(i \cdot y\right)\right) \cdot j \]
      4. distribute-lft-neg-outN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot y\right) \cdot j \]
      5. lower-*.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot y\right) \cdot j \]
      6. lift-neg.f6444.6

        \[\leadsto \left(\left(-i\right) \cdot y\right) \cdot j \]
    10. Applied rewrites44.6%

      \[\leadsto \color{blue}{\left(\left(-i\right) \cdot y\right) \cdot j} \]

    if -5.4e50 < i < 2.3999999999999998e-128

    1. Initial program 87.5%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{z \cdot \left(x \cdot y - b \cdot c\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(x \cdot y + \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      4. *-commutativeN/A

        \[\leadsto \left(y \cdot x + \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(y, x, \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, x, \left(\mathsf{neg}\left(b\right)\right) \cdot c\right) \cdot z \]
      7. lower-neg.f6457.6

        \[\leadsto \mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z \]
    5. Applied rewrites57.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, x, \left(-b\right) \cdot c\right) \cdot z} \]
    6. Taylor expanded in x around inf

      \[\leadsto \left(x \cdot y\right) \cdot z \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(y \cdot x\right) \cdot z \]
      2. lower-*.f6438.1

        \[\leadsto \left(y \cdot x\right) \cdot z \]
    8. Applied rewrites38.1%

      \[\leadsto \left(y \cdot x\right) \cdot z \]

    if 2.3999999999999998e-128 < i < 3.2000000000000001e-7

    1. Initial program 90.6%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in j around inf

      \[\leadsto \color{blue}{j \cdot \left(a \cdot c - i \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot \color{blue}{j} \]
      2. *-commutativeN/A

        \[\leadsto \left(c \cdot a - i \cdot y\right) \cdot j \]
      3. *-commutativeN/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot j \]
      4. lower-*.f64N/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot \color{blue}{j} \]
      5. *-commutativeN/A

        \[\leadsto \left(a \cdot c - y \cdot i\right) \cdot j \]
      6. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot j \]
      7. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(a \cdot c + \left(\mathsf{neg}\left(i\right)\right) \cdot y\right) \cdot j \]
      8. mul-1-negN/A

        \[\leadsto \left(a \cdot c + \left(-1 \cdot i\right) \cdot y\right) \cdot j \]
      9. associate-*r*N/A

        \[\leadsto \left(a \cdot c + -1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      10. +-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right) + a \cdot c\right) \cdot j \]
      11. associate-*r*N/A

        \[\leadsto \left(\left(-1 \cdot i\right) \cdot y + a \cdot c\right) \cdot j \]
      12. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot y + a \cdot c\right) \cdot j \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), y, a \cdot c\right) \cdot j \]
      14. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(-i, y, a \cdot c\right) \cdot j \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
      16. lift-*.f6445.8

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
    5. Applied rewrites45.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j} \]
    6. Taylor expanded in y around 0

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

        \[\leadsto a \cdot \left(c \cdot \color{blue}{j}\right) \]
      2. lower-*.f6445.5

        \[\leadsto a \cdot \left(c \cdot j\right) \]
    8. Applied rewrites45.5%

      \[\leadsto a \cdot \color{blue}{\left(c \cdot j\right)} \]

    if 3.2000000000000001e-7 < i

    1. Initial program 62.6%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf

      \[\leadsto \color{blue}{b \cdot \left(i \cdot t - c \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(i \cdot t + \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      8. lower-neg.f6457.3

        \[\leadsto \mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b \]
    5. Applied rewrites57.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b} \]
    6. Taylor expanded in z around 0

      \[\leadsto \left(i \cdot t\right) \cdot b \]
    7. Step-by-step derivation
      1. lower-*.f6446.4

        \[\leadsto \left(i \cdot t\right) \cdot b \]
    8. Applied rewrites46.4%

      \[\leadsto \left(i \cdot t\right) \cdot b \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 12: 29.4% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;j \leq -7.6 \cdot 10^{+45} \lor \neg \left(j \leq 3.5 \cdot 10^{+28}\right):\\ \;\;\;\;a \cdot \left(c \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;\left(i \cdot t\right) \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (if (or (<= j -7.6e+45) (not (<= j 3.5e+28))) (* a (* c j)) (* (* i t) b)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double tmp;
	if ((j <= -7.6e+45) || !(j <= 3.5e+28)) {
		tmp = a * (c * j);
	} else {
		tmp = (i * t) * b;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8), intent (in) :: j
    real(8) :: tmp
    if ((j <= (-7.6d+45)) .or. (.not. (j <= 3.5d+28))) then
        tmp = a * (c * j)
    else
        tmp = (i * t) * b
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double tmp;
	if ((j <= -7.6e+45) || !(j <= 3.5e+28)) {
		tmp = a * (c * j);
	} else {
		tmp = (i * t) * b;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j):
	tmp = 0
	if (j <= -7.6e+45) or not (j <= 3.5e+28):
		tmp = a * (c * j)
	else:
		tmp = (i * t) * b
	return tmp
function code(x, y, z, t, a, b, c, i, j)
	tmp = 0.0
	if ((j <= -7.6e+45) || !(j <= 3.5e+28))
		tmp = Float64(a * Float64(c * j));
	else
		tmp = Float64(Float64(i * t) * b);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j)
	tmp = 0.0;
	if ((j <= -7.6e+45) || ~((j <= 3.5e+28)))
		tmp = a * (c * j);
	else
		tmp = (i * t) * b;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := If[Or[LessEqual[j, -7.6e+45], N[Not[LessEqual[j, 3.5e+28]], $MachinePrecision]], N[(a * N[(c * j), $MachinePrecision]), $MachinePrecision], N[(N[(i * t), $MachinePrecision] * b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;j \leq -7.6 \cdot 10^{+45} \lor \neg \left(j \leq 3.5 \cdot 10^{+28}\right):\\
\;\;\;\;a \cdot \left(c \cdot j\right)\\

\mathbf{else}:\\
\;\;\;\;\left(i \cdot t\right) \cdot b\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if j < -7.6000000000000004e45 or 3.5e28 < j

    1. Initial program 77.8%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in j around inf

      \[\leadsto \color{blue}{j \cdot \left(a \cdot c - i \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot \color{blue}{j} \]
      2. *-commutativeN/A

        \[\leadsto \left(c \cdot a - i \cdot y\right) \cdot j \]
      3. *-commutativeN/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot j \]
      4. lower-*.f64N/A

        \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot \color{blue}{j} \]
      5. *-commutativeN/A

        \[\leadsto \left(a \cdot c - y \cdot i\right) \cdot j \]
      6. *-commutativeN/A

        \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot j \]
      7. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(a \cdot c + \left(\mathsf{neg}\left(i\right)\right) \cdot y\right) \cdot j \]
      8. mul-1-negN/A

        \[\leadsto \left(a \cdot c + \left(-1 \cdot i\right) \cdot y\right) \cdot j \]
      9. associate-*r*N/A

        \[\leadsto \left(a \cdot c + -1 \cdot \left(i \cdot y\right)\right) \cdot j \]
      10. +-commutativeN/A

        \[\leadsto \left(-1 \cdot \left(i \cdot y\right) + a \cdot c\right) \cdot j \]
      11. associate-*r*N/A

        \[\leadsto \left(\left(-1 \cdot i\right) \cdot y + a \cdot c\right) \cdot j \]
      12. mul-1-negN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot y + a \cdot c\right) \cdot j \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), y, a \cdot c\right) \cdot j \]
      14. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(-i, y, a \cdot c\right) \cdot j \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
      16. lift-*.f6467.8

        \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
    5. Applied rewrites67.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j} \]
    6. Taylor expanded in y around 0

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

        \[\leadsto a \cdot \left(c \cdot \color{blue}{j}\right) \]
      2. lower-*.f6442.3

        \[\leadsto a \cdot \left(c \cdot j\right) \]
    8. Applied rewrites42.3%

      \[\leadsto a \cdot \color{blue}{\left(c \cdot j\right)} \]

    if -7.6000000000000004e45 < j < 3.5e28

    1. Initial program 75.5%

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf

      \[\leadsto \color{blue}{b \cdot \left(i \cdot t - c \cdot z\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \left(i \cdot t + \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(-1 \cdot c\right) \cdot z\right) \cdot b \]
      7. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(i, t, \left(\mathsf{neg}\left(c\right)\right) \cdot z\right) \cdot b \]
      8. lower-neg.f6448.0

        \[\leadsto \mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b \]
    5. Applied rewrites48.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(i, t, \left(-c\right) \cdot z\right) \cdot b} \]
    6. Taylor expanded in z around 0

      \[\leadsto \left(i \cdot t\right) \cdot b \]
    7. Step-by-step derivation
      1. lower-*.f6430.1

        \[\leadsto \left(i \cdot t\right) \cdot b \]
    8. Applied rewrites30.1%

      \[\leadsto \left(i \cdot t\right) \cdot b \]
  3. Recombined 2 regimes into one program.
  4. Final simplification35.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;j \leq -7.6 \cdot 10^{+45} \lor \neg \left(j \leq 3.5 \cdot 10^{+28}\right):\\ \;\;\;\;a \cdot \left(c \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;\left(i \cdot t\right) \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 22.3% accurate, 5.5× speedup?

\[\begin{array}{l} \\ a \cdot \left(c \cdot j\right) \end{array} \]
(FPCore (x y z t a b c i j) :precision binary64 (* a (* c j)))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	return a * (c * j);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b, c, i, j)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8), intent (in) :: j
    code = a * (c * j)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	return a * (c * j);
}
def code(x, y, z, t, a, b, c, i, j):
	return a * (c * j)
function code(x, y, z, t, a, b, c, i, j)
	return Float64(a * Float64(c * j))
end
function tmp = code(x, y, z, t, a, b, c, i, j)
	tmp = a * (c * j);
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(a * N[(c * j), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
a \cdot \left(c \cdot j\right)
\end{array}
Derivation
  1. Initial program 76.4%

    \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right) \]
  2. Add Preprocessing
  3. Taylor expanded in j around inf

    \[\leadsto \color{blue}{j \cdot \left(a \cdot c - i \cdot y\right)} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot \color{blue}{j} \]
    2. *-commutativeN/A

      \[\leadsto \left(c \cdot a - i \cdot y\right) \cdot j \]
    3. *-commutativeN/A

      \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot j \]
    4. lower-*.f64N/A

      \[\leadsto \left(c \cdot a - y \cdot i\right) \cdot \color{blue}{j} \]
    5. *-commutativeN/A

      \[\leadsto \left(a \cdot c - y \cdot i\right) \cdot j \]
    6. *-commutativeN/A

      \[\leadsto \left(a \cdot c - i \cdot y\right) \cdot j \]
    7. fp-cancel-sub-sign-invN/A

      \[\leadsto \left(a \cdot c + \left(\mathsf{neg}\left(i\right)\right) \cdot y\right) \cdot j \]
    8. mul-1-negN/A

      \[\leadsto \left(a \cdot c + \left(-1 \cdot i\right) \cdot y\right) \cdot j \]
    9. associate-*r*N/A

      \[\leadsto \left(a \cdot c + -1 \cdot \left(i \cdot y\right)\right) \cdot j \]
    10. +-commutativeN/A

      \[\leadsto \left(-1 \cdot \left(i \cdot y\right) + a \cdot c\right) \cdot j \]
    11. associate-*r*N/A

      \[\leadsto \left(\left(-1 \cdot i\right) \cdot y + a \cdot c\right) \cdot j \]
    12. mul-1-negN/A

      \[\leadsto \left(\left(\mathsf{neg}\left(i\right)\right) \cdot y + a \cdot c\right) \cdot j \]
    13. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(i\right), y, a \cdot c\right) \cdot j \]
    14. lower-neg.f64N/A

      \[\leadsto \mathsf{fma}\left(-i, y, a \cdot c\right) \cdot j \]
    15. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
    16. lift-*.f6437.4

      \[\leadsto \mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j \]
  5. Applied rewrites37.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-i, y, c \cdot a\right) \cdot j} \]
  6. Taylor expanded in y around 0

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

      \[\leadsto a \cdot \left(c \cdot \color{blue}{j}\right) \]
    2. lower-*.f6421.7

      \[\leadsto a \cdot \left(c \cdot j\right) \]
  8. Applied rewrites21.7%

    \[\leadsto a \cdot \color{blue}{\left(c \cdot j\right)} \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2025085 
(FPCore (x y z t a b c i j)
  :name "Data.Colour.Matrix:determinant from colour-2.3.3, A"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< x -293938859355541/2000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))) (if (< x 32113527362226803/10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (- (* b i) (* x a)) t) (- (* z (* c b)) (* j (- (* c a) (* y i))))) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))))))

  (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))