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

Percentage Accurate: 74.1% → 82.8%
Time: 5.4s
Alternatives: 13
Speedup: 0.5×

Specification

?
\[\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) \]
(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]
\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)

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

\[\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) \]
(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]
\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)

Alternative 1: 82.8% accurate, 0.5× speedup?

\[\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}:\\ \;\;\;\;z \cdot \left(b \cdot \left(\frac{x \cdot y}{b} - c\right)\right)\\ \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 (* z (* b (- (/ (* x y) b) c))))))
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 = z * (b * (((x * y) / b) - c));
	}
	return tmp;
}
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 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
	double tmp;
	if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = z * (b * (((x * y) / b) - c));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j):
	t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
	tmp = 0
	if t_1 <= math.inf:
		tmp = t_1
	else:
		tmp = z * (b * (((x * y) / b) - c))
	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(z * Float64(b * Float64(Float64(Float64(x * y) / b) - c)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j)
	t_1 = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
	tmp = 0.0;
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = z * (b * (((x * y) / b) - c));
	end
	tmp_2 = 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[(z * N[(b * N[(N[(N[(x * y), $MachinePrecision] / b), $MachinePrecision] - c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\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}:\\
\;\;\;\;z \cdot \left(b \cdot \left(\frac{x \cdot y}{b} - c\right)\right)\\


\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 74.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) \]

    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 74.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. Taylor expanded in z around inf

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

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

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

        \[\leadsto z \cdot \left(x \cdot y - \color{blue}{b} \cdot c\right) \]
      4. lower-*.f6438.5%

        \[\leadsto z \cdot \left(x \cdot y - b \cdot \color{blue}{c}\right) \]
    4. Applied rewrites38.5%

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

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

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

        \[\leadsto z \cdot \left(b \cdot \left(\frac{x \cdot y}{b} - c\right)\right) \]
      3. lower-/.f64N/A

        \[\leadsto z \cdot \left(b \cdot \left(\frac{x \cdot y}{b} - c\right)\right) \]
      4. lower-*.f6439.3%

        \[\leadsto z \cdot \left(b \cdot \left(\frac{x \cdot y}{b} - c\right)\right) \]
    7. Applied rewrites39.3%

      \[\leadsto z \cdot \left(b \cdot \color{blue}{\left(\frac{x \cdot y}{b} - c\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 67.4% accurate, 1.2× speedup?

\[\begin{array}{l} t_1 := b \cdot \left(i \cdot t - c \cdot z\right)\\ \mathbf{if}\;b \leq -1.3 \cdot 10^{+149}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq 7.5 \cdot 10^{+164}:\\ \;\;\;\;\mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z - a \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* b (- (* i t) (* c z)))))
   (if (<= b -1.3e+149)
     t_1
     (if (<= b 7.5e+164)
       (fma j (- (* a c) (* i y)) (* x (- (* y z) (* a t))))
       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 = b * ((i * t) - (c * z));
	double tmp;
	if (b <= -1.3e+149) {
		tmp = t_1;
	} else if (b <= 7.5e+164) {
		tmp = fma(j, ((a * c) - (i * y)), (x * ((y * z) - (a * t))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(b * Float64(Float64(i * t) - Float64(c * z)))
	tmp = 0.0
	if (b <= -1.3e+149)
		tmp = t_1;
	elseif (b <= 7.5e+164)
		tmp = fma(j, Float64(Float64(a * c) - Float64(i * y)), Float64(x * Float64(Float64(y * z) - Float64(a * t))));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(b * N[(N[(i * t), $MachinePrecision] - N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.3e+149], t$95$1, If[LessEqual[b, 7.5e+164], N[(j * N[(N[(a * c), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision] + N[(x * N[(N[(y * z), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := b \cdot \left(i \cdot t - c \cdot z\right)\\
\mathbf{if}\;b \leq -1.3 \cdot 10^{+149}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq 7.5 \cdot 10^{+164}:\\
\;\;\;\;\mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z - a \cdot t\right)\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -1.29999999999999989e149 or 7.49999999999999976e164 < b

    1. Initial program 74.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. Taylor expanded in b around inf

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

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

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

        \[\leadsto b \cdot \left(i \cdot t - \color{blue}{c} \cdot z\right) \]
      4. lower-*.f6438.6%

        \[\leadsto b \cdot \left(i \cdot t - c \cdot \color{blue}{z}\right) \]
    4. Applied rewrites38.6%

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

    if -1.29999999999999989e149 < b < 7.49999999999999976e164

    1. Initial program 74.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. 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)} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      8. lower-*.f6461.4%

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

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

Alternative 3: 57.8% accurate, 1.5× speedup?

\[\begin{array}{l} t_1 := b \cdot \left(i \cdot t - c \cdot z\right)\\ \mathbf{if}\;b \leq -3.3 \cdot 10^{+142}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq 7.5 \cdot 10^{+164}:\\ \;\;\;\;\mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* b (- (* i t) (* c z)))))
   (if (<= b -3.3e+142)
     t_1
     (if (<= b 7.5e+164) (fma j (- (* a c) (* i y)) (* x (* y z))) 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 = b * ((i * t) - (c * z));
	double tmp;
	if (b <= -3.3e+142) {
		tmp = t_1;
	} else if (b <= 7.5e+164) {
		tmp = fma(j, ((a * c) - (i * y)), (x * (y * z)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(b * Float64(Float64(i * t) - Float64(c * z)))
	tmp = 0.0
	if (b <= -3.3e+142)
		tmp = t_1;
	elseif (b <= 7.5e+164)
		tmp = fma(j, Float64(Float64(a * c) - Float64(i * y)), Float64(x * Float64(y * z)));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(b * N[(N[(i * t), $MachinePrecision] - N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.3e+142], t$95$1, If[LessEqual[b, 7.5e+164], N[(j * N[(N[(a * c), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision] + N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := b \cdot \left(i \cdot t - c \cdot z\right)\\
\mathbf{if}\;b \leq -3.3 \cdot 10^{+142}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq 7.5 \cdot 10^{+164}:\\
\;\;\;\;\mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z\right)\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -3.3000000000000002e142 or 7.49999999999999976e164 < b

    1. Initial program 74.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. Taylor expanded in b around inf

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

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

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

        \[\leadsto b \cdot \left(i \cdot t - \color{blue}{c} \cdot z\right) \]
      4. lower-*.f6438.6%

        \[\leadsto b \cdot \left(i \cdot t - c \cdot \color{blue}{z}\right) \]
    4. Applied rewrites38.6%

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

    if -3.3000000000000002e142 < b < 7.49999999999999976e164

    1. Initial program 74.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. 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)} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      8. lower-*.f6461.4%

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

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

      \[\leadsto \mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z\right)\right) \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z\right)\right) \]
      2. lower-*.f6450.1%

        \[\leadsto \mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z\right)\right) \]
    7. Applied rewrites50.1%

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

Alternative 4: 51.4% accurate, 1.7× speedup?

\[\begin{array}{l} t_1 := b \cdot \left(i \cdot t - c \cdot z\right)\\ \mathbf{if}\;b \leq -3.3 \cdot 10^{+142}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq -3.6 \cdot 10^{-286}:\\ \;\;\;\;j \cdot \left(a \cdot c - i \cdot y\right)\\ \mathbf{elif}\;b \leq 1.85 \cdot 10^{+90}:\\ \;\;\;\;\left(z \cdot y - a \cdot t\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* b (- (* i t) (* c z)))))
   (if (<= b -3.3e+142)
     t_1
     (if (<= b -3.6e-286)
       (* j (- (* a c) (* i y)))
       (if (<= b 1.85e+90) (* (- (* z y) (* a t)) 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 = b * ((i * t) - (c * z));
	double tmp;
	if (b <= -3.3e+142) {
		tmp = t_1;
	} else if (b <= -3.6e-286) {
		tmp = j * ((a * c) - (i * y));
	} else if (b <= 1.85e+90) {
		tmp = ((z * y) - (a * t)) * x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, 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) :: tmp
    t_1 = b * ((i * t) - (c * z))
    if (b <= (-3.3d+142)) then
        tmp = t_1
    else if (b <= (-3.6d-286)) then
        tmp = j * ((a * c) - (i * y))
    else if (b <= 1.85d+90) then
        tmp = ((z * y) - (a * t)) * x
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = b * ((i * t) - (c * z));
	double tmp;
	if (b <= -3.3e+142) {
		tmp = t_1;
	} else if (b <= -3.6e-286) {
		tmp = j * ((a * c) - (i * y));
	} else if (b <= 1.85e+90) {
		tmp = ((z * y) - (a * t)) * x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j):
	t_1 = b * ((i * t) - (c * z))
	tmp = 0
	if b <= -3.3e+142:
		tmp = t_1
	elif b <= -3.6e-286:
		tmp = j * ((a * c) - (i * y))
	elif b <= 1.85e+90:
		tmp = ((z * y) - (a * t)) * x
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(b * Float64(Float64(i * t) - Float64(c * z)))
	tmp = 0.0
	if (b <= -3.3e+142)
		tmp = t_1;
	elseif (b <= -3.6e-286)
		tmp = Float64(j * Float64(Float64(a * c) - Float64(i * y)));
	elseif (b <= 1.85e+90)
		tmp = Float64(Float64(Float64(z * y) - Float64(a * t)) * x);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j)
	t_1 = b * ((i * t) - (c * z));
	tmp = 0.0;
	if (b <= -3.3e+142)
		tmp = t_1;
	elseif (b <= -3.6e-286)
		tmp = j * ((a * c) - (i * y));
	elseif (b <= 1.85e+90)
		tmp = ((z * y) - (a * t)) * x;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(b * N[(N[(i * t), $MachinePrecision] - N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.3e+142], t$95$1, If[LessEqual[b, -3.6e-286], N[(j * N[(N[(a * c), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.85e+90], N[(N[(N[(z * y), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := b \cdot \left(i \cdot t - c \cdot z\right)\\
\mathbf{if}\;b \leq -3.3 \cdot 10^{+142}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq -3.6 \cdot 10^{-286}:\\
\;\;\;\;j \cdot \left(a \cdot c - i \cdot y\right)\\

\mathbf{elif}\;b \leq 1.85 \cdot 10^{+90}:\\
\;\;\;\;\left(z \cdot y - a \cdot t\right) \cdot x\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -3.3000000000000002e142 or 1.85e90 < b

    1. Initial program 74.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. Taylor expanded in b around inf

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

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

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

        \[\leadsto b \cdot \left(i \cdot t - \color{blue}{c} \cdot z\right) \]
      4. lower-*.f6438.6%

        \[\leadsto b \cdot \left(i \cdot t - c \cdot \color{blue}{z}\right) \]
    4. Applied rewrites38.6%

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

    if -3.3000000000000002e142 < b < -3.60000000000000013e-286

    1. Initial program 74.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. 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)} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      8. lower-*.f6461.4%

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

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

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

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

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

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) \]
      4. lower-*.f6438.9%

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) \]
    7. Applied rewrites38.9%

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

    if -3.60000000000000013e-286 < b < 1.85e90

    1. Initial program 74.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. Applied rewrites75.6%

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

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

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

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

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

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

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

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

Alternative 5: 51.3% accurate, 1.7× speedup?

\[\begin{array}{l} t_1 := j \cdot \left(a \cdot c - i \cdot y\right)\\ \mathbf{if}\;j \leq -3.9 \cdot 10^{-47}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;j \leq 4 \cdot 10^{-163}:\\ \;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right)\\ \mathbf{elif}\;j \leq 1.08 \cdot 10^{+24}:\\ \;\;\;\;\left(b \cdot i - a \cdot x\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* j (- (* a c) (* i y)))))
   (if (<= j -3.9e-47)
     t_1
     (if (<= j 4e-163)
       (* z (- (* x y) (* b c)))
       (if (<= j 1.08e+24) (* (- (* b i) (* a x)) t) 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 = j * ((a * c) - (i * y));
	double tmp;
	if (j <= -3.9e-47) {
		tmp = t_1;
	} else if (j <= 4e-163) {
		tmp = z * ((x * y) - (b * c));
	} else if (j <= 1.08e+24) {
		tmp = ((b * i) - (a * x)) * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, 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) :: tmp
    t_1 = j * ((a * c) - (i * y))
    if (j <= (-3.9d-47)) then
        tmp = t_1
    else if (j <= 4d-163) then
        tmp = z * ((x * y) - (b * c))
    else if (j <= 1.08d+24) then
        tmp = ((b * i) - (a * x)) * t
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = j * ((a * c) - (i * y));
	double tmp;
	if (j <= -3.9e-47) {
		tmp = t_1;
	} else if (j <= 4e-163) {
		tmp = z * ((x * y) - (b * c));
	} else if (j <= 1.08e+24) {
		tmp = ((b * i) - (a * x)) * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j):
	t_1 = j * ((a * c) - (i * y))
	tmp = 0
	if j <= -3.9e-47:
		tmp = t_1
	elif j <= 4e-163:
		tmp = z * ((x * y) - (b * c))
	elif j <= 1.08e+24:
		tmp = ((b * i) - (a * x)) * t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(j * Float64(Float64(a * c) - Float64(i * y)))
	tmp = 0.0
	if (j <= -3.9e-47)
		tmp = t_1;
	elseif (j <= 4e-163)
		tmp = Float64(z * Float64(Float64(x * y) - Float64(b * c)));
	elseif (j <= 1.08e+24)
		tmp = Float64(Float64(Float64(b * i) - Float64(a * x)) * t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j)
	t_1 = j * ((a * c) - (i * y));
	tmp = 0.0;
	if (j <= -3.9e-47)
		tmp = t_1;
	elseif (j <= 4e-163)
		tmp = z * ((x * y) - (b * c));
	elseif (j <= 1.08e+24)
		tmp = ((b * i) - (a * x)) * t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(j * N[(N[(a * c), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[j, -3.9e-47], t$95$1, If[LessEqual[j, 4e-163], N[(z * N[(N[(x * y), $MachinePrecision] - N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[j, 1.08e+24], N[(N[(N[(b * i), $MachinePrecision] - N[(a * x), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := j \cdot \left(a \cdot c - i \cdot y\right)\\
\mathbf{if}\;j \leq -3.9 \cdot 10^{-47}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;j \leq 4 \cdot 10^{-163}:\\
\;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right)\\

\mathbf{elif}\;j \leq 1.08 \cdot 10^{+24}:\\
\;\;\;\;\left(b \cdot i - a \cdot x\right) \cdot t\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if j < -3.89999999999999978e-47 or 1.0799999999999999e24 < j

    1. Initial program 74.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. 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)} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      8. lower-*.f6461.4%

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

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

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

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

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

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) \]
      4. lower-*.f6438.9%

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) \]
    7. Applied rewrites38.9%

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

    if -3.89999999999999978e-47 < j < 3.99999999999999969e-163

    1. Initial program 74.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. Taylor expanded in z around inf

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

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

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

        \[\leadsto z \cdot \left(x \cdot y - \color{blue}{b} \cdot c\right) \]
      4. lower-*.f6438.5%

        \[\leadsto z \cdot \left(x \cdot y - b \cdot \color{blue}{c}\right) \]
    4. Applied rewrites38.5%

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

    if 3.99999999999999969e-163 < j < 1.0799999999999999e24

    1. Initial program 74.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. Taylor expanded in t around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot \left(a \cdot x - b \cdot i\right)\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto -1 \cdot \left(t \cdot \color{blue}{\left(a \cdot x - b \cdot i\right)}\right) \]
      3. lower--.f64N/A

        \[\leadsto -1 \cdot \left(t \cdot \left(a \cdot x - \color{blue}{b \cdot i}\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(t \cdot \left(a \cdot x - \color{blue}{b} \cdot i\right)\right) \]
      5. lower-*.f6439.7%

        \[\leadsto -1 \cdot \left(t \cdot \left(a \cdot x - b \cdot \color{blue}{i}\right)\right) \]
    4. Applied rewrites39.7%

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot \left(a \cdot x - b \cdot i\right)\right)} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \mathsf{neg}\left(t \cdot \left(a \cdot x - b \cdot i\right)\right) \]
      3. lift-*.f64N/A

        \[\leadsto \mathsf{neg}\left(t \cdot \left(a \cdot x - b \cdot i\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\left(a \cdot x - b \cdot i\right) \cdot t\right) \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(a \cdot x - b \cdot i\right)\right)\right) \cdot \color{blue}{t} \]
      6. lift--.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(a \cdot x - b \cdot i\right)\right)\right) \cdot t \]
      7. sub-negate-revN/A

        \[\leadsto \left(b \cdot i - a \cdot x\right) \cdot t \]
      8. lower-*.f64N/A

        \[\leadsto \left(b \cdot i - a \cdot x\right) \cdot \color{blue}{t} \]
      9. lower--.f6439.7%

        \[\leadsto \left(b \cdot i - a \cdot x\right) \cdot t \]
    6. Applied rewrites39.7%

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

Alternative 6: 50.8% accurate, 2.0× speedup?

\[\begin{array}{l} t_1 := j \cdot \left(a \cdot c - i \cdot y\right)\\ \mathbf{if}\;j \leq -3.9 \cdot 10^{-47}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;j \leq 1.35 \cdot 10^{+23}:\\ \;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* j (- (* a c) (* i y)))))
   (if (<= j -3.9e-47)
     t_1
     (if (<= j 1.35e+23) (* z (- (* x y) (* b c))) 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 = j * ((a * c) - (i * y));
	double tmp;
	if (j <= -3.9e-47) {
		tmp = t_1;
	} else if (j <= 1.35e+23) {
		tmp = z * ((x * y) - (b * c));
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, 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) :: tmp
    t_1 = j * ((a * c) - (i * y))
    if (j <= (-3.9d-47)) then
        tmp = t_1
    else if (j <= 1.35d+23) then
        tmp = z * ((x * y) - (b * c))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = j * ((a * c) - (i * y));
	double tmp;
	if (j <= -3.9e-47) {
		tmp = t_1;
	} else if (j <= 1.35e+23) {
		tmp = z * ((x * y) - (b * c));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j):
	t_1 = j * ((a * c) - (i * y))
	tmp = 0
	if j <= -3.9e-47:
		tmp = t_1
	elif j <= 1.35e+23:
		tmp = z * ((x * y) - (b * c))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(j * Float64(Float64(a * c) - Float64(i * y)))
	tmp = 0.0
	if (j <= -3.9e-47)
		tmp = t_1;
	elseif (j <= 1.35e+23)
		tmp = Float64(z * Float64(Float64(x * y) - Float64(b * c)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j)
	t_1 = j * ((a * c) - (i * y));
	tmp = 0.0;
	if (j <= -3.9e-47)
		tmp = t_1;
	elseif (j <= 1.35e+23)
		tmp = z * ((x * y) - (b * c));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(j * N[(N[(a * c), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[j, -3.9e-47], t$95$1, If[LessEqual[j, 1.35e+23], N[(z * N[(N[(x * y), $MachinePrecision] - N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := j \cdot \left(a \cdot c - i \cdot y\right)\\
\mathbf{if}\;j \leq -3.9 \cdot 10^{-47}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;j \leq 1.35 \cdot 10^{+23}:\\
\;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if j < -3.89999999999999978e-47 or 1.3499999999999999e23 < j

    1. Initial program 74.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. 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)} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      8. lower-*.f6461.4%

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

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

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

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

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

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) \]
      4. lower-*.f6438.9%

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) \]
    7. Applied rewrites38.9%

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

    if -3.89999999999999978e-47 < j < 1.3499999999999999e23

    1. Initial program 74.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. Taylor expanded in z around inf

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

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

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

        \[\leadsto z \cdot \left(x \cdot y - \color{blue}{b} \cdot c\right) \]
      4. lower-*.f6438.5%

        \[\leadsto z \cdot \left(x \cdot y - b \cdot \color{blue}{c}\right) \]
    4. Applied rewrites38.5%

      \[\leadsto \color{blue}{z \cdot \left(x \cdot y - b \cdot c\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 48.2% accurate, 1.7× speedup?

\[\begin{array}{l} t_1 := b \cdot \left(i \cdot t - c \cdot z\right)\\ \mathbf{if}\;b \leq -3.3 \cdot 10^{+142}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq 6.6 \cdot 10^{-49}:\\ \;\;\;\;j \cdot \left(a \cdot c - i \cdot y\right)\\ \mathbf{elif}\;b \leq 2.8 \cdot 10^{+89}:\\ \;\;\;\;a \cdot \left(-1 \cdot \left(t \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* b (- (* i t) (* c z)))))
   (if (<= b -3.3e+142)
     t_1
     (if (<= b 6.6e-49)
       (* j (- (* a c) (* i y)))
       (if (<= b 2.8e+89) (* a (* -1.0 (* t 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 = b * ((i * t) - (c * z));
	double tmp;
	if (b <= -3.3e+142) {
		tmp = t_1;
	} else if (b <= 6.6e-49) {
		tmp = j * ((a * c) - (i * y));
	} else if (b <= 2.8e+89) {
		tmp = a * (-1.0 * (t * x));
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, 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) :: tmp
    t_1 = b * ((i * t) - (c * z))
    if (b <= (-3.3d+142)) then
        tmp = t_1
    else if (b <= 6.6d-49) then
        tmp = j * ((a * c) - (i * y))
    else if (b <= 2.8d+89) then
        tmp = a * ((-1.0d0) * (t * x))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = b * ((i * t) - (c * z));
	double tmp;
	if (b <= -3.3e+142) {
		tmp = t_1;
	} else if (b <= 6.6e-49) {
		tmp = j * ((a * c) - (i * y));
	} else if (b <= 2.8e+89) {
		tmp = a * (-1.0 * (t * x));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j):
	t_1 = b * ((i * t) - (c * z))
	tmp = 0
	if b <= -3.3e+142:
		tmp = t_1
	elif b <= 6.6e-49:
		tmp = j * ((a * c) - (i * y))
	elif b <= 2.8e+89:
		tmp = a * (-1.0 * (t * x))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(b * Float64(Float64(i * t) - Float64(c * z)))
	tmp = 0.0
	if (b <= -3.3e+142)
		tmp = t_1;
	elseif (b <= 6.6e-49)
		tmp = Float64(j * Float64(Float64(a * c) - Float64(i * y)));
	elseif (b <= 2.8e+89)
		tmp = Float64(a * Float64(-1.0 * Float64(t * x)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j)
	t_1 = b * ((i * t) - (c * z));
	tmp = 0.0;
	if (b <= -3.3e+142)
		tmp = t_1;
	elseif (b <= 6.6e-49)
		tmp = j * ((a * c) - (i * y));
	elseif (b <= 2.8e+89)
		tmp = a * (-1.0 * (t * x));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(b * N[(N[(i * t), $MachinePrecision] - N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.3e+142], t$95$1, If[LessEqual[b, 6.6e-49], N[(j * N[(N[(a * c), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.8e+89], N[(a * N[(-1.0 * N[(t * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := b \cdot \left(i \cdot t - c \cdot z\right)\\
\mathbf{if}\;b \leq -3.3 \cdot 10^{+142}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq 6.6 \cdot 10^{-49}:\\
\;\;\;\;j \cdot \left(a \cdot c - i \cdot y\right)\\

\mathbf{elif}\;b \leq 2.8 \cdot 10^{+89}:\\
\;\;\;\;a \cdot \left(-1 \cdot \left(t \cdot x\right)\right)\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -3.3000000000000002e142 or 2.7999999999999998e89 < b

    1. Initial program 74.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. Taylor expanded in b around inf

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

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

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

        \[\leadsto b \cdot \left(i \cdot t - \color{blue}{c} \cdot z\right) \]
      4. lower-*.f6438.6%

        \[\leadsto b \cdot \left(i \cdot t - c \cdot \color{blue}{z}\right) \]
    4. Applied rewrites38.6%

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

    if -3.3000000000000002e142 < b < 6.6e-49

    1. Initial program 74.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. 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)} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      8. lower-*.f6461.4%

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

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

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

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

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

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) \]
      4. lower-*.f6438.9%

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) \]
    7. Applied rewrites38.9%

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

    if 6.6e-49 < b < 2.7999999999999998e89

    1. Initial program 74.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. Taylor expanded in a around inf

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

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

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

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot \color{blue}{x}, c \cdot j\right) \]
      4. lower-*.f6440.0%

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot x, c \cdot j\right) \]
    4. Applied rewrites40.0%

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

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

        \[\leadsto a \cdot \left(-1 \cdot \left(t \cdot \color{blue}{x}\right)\right) \]
      2. lower-*.f6422.8%

        \[\leadsto a \cdot \left(-1 \cdot \left(t \cdot x\right)\right) \]
    7. Applied rewrites22.8%

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

Alternative 8: 42.5% accurate, 1.7× speedup?

\[\begin{array}{l} t_1 := j \cdot \left(a \cdot c - i \cdot y\right)\\ \mathbf{if}\;j \leq -3.3 \cdot 10^{-47}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;j \leq -1.02 \cdot 10^{-168}:\\ \;\;\;\;a \cdot \left(-1 \cdot \left(t \cdot x\right)\right)\\ \mathbf{elif}\;j \leq 3.3 \cdot 10^{-93}:\\ \;\;\;\;b \cdot \left(-1 \cdot \left(c \cdot z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* j (- (* a c) (* i y)))))
   (if (<= j -3.3e-47)
     t_1
     (if (<= j -1.02e-168)
       (* a (* -1.0 (* t x)))
       (if (<= j 3.3e-93) (* b (* -1.0 (* c z))) 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 = j * ((a * c) - (i * y));
	double tmp;
	if (j <= -3.3e-47) {
		tmp = t_1;
	} else if (j <= -1.02e-168) {
		tmp = a * (-1.0 * (t * x));
	} else if (j <= 3.3e-93) {
		tmp = b * (-1.0 * (c * z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, 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) :: tmp
    t_1 = j * ((a * c) - (i * y))
    if (j <= (-3.3d-47)) then
        tmp = t_1
    else if (j <= (-1.02d-168)) then
        tmp = a * ((-1.0d0) * (t * x))
    else if (j <= 3.3d-93) then
        tmp = b * ((-1.0d0) * (c * z))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = j * ((a * c) - (i * y));
	double tmp;
	if (j <= -3.3e-47) {
		tmp = t_1;
	} else if (j <= -1.02e-168) {
		tmp = a * (-1.0 * (t * x));
	} else if (j <= 3.3e-93) {
		tmp = b * (-1.0 * (c * z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j):
	t_1 = j * ((a * c) - (i * y))
	tmp = 0
	if j <= -3.3e-47:
		tmp = t_1
	elif j <= -1.02e-168:
		tmp = a * (-1.0 * (t * x))
	elif j <= 3.3e-93:
		tmp = b * (-1.0 * (c * z))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(j * Float64(Float64(a * c) - Float64(i * y)))
	tmp = 0.0
	if (j <= -3.3e-47)
		tmp = t_1;
	elseif (j <= -1.02e-168)
		tmp = Float64(a * Float64(-1.0 * Float64(t * x)));
	elseif (j <= 3.3e-93)
		tmp = Float64(b * Float64(-1.0 * Float64(c * z)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j)
	t_1 = j * ((a * c) - (i * y));
	tmp = 0.0;
	if (j <= -3.3e-47)
		tmp = t_1;
	elseif (j <= -1.02e-168)
		tmp = a * (-1.0 * (t * x));
	elseif (j <= 3.3e-93)
		tmp = b * (-1.0 * (c * z));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(j * N[(N[(a * c), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[j, -3.3e-47], t$95$1, If[LessEqual[j, -1.02e-168], N[(a * N[(-1.0 * N[(t * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[j, 3.3e-93], N[(b * N[(-1.0 * N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := j \cdot \left(a \cdot c - i \cdot y\right)\\
\mathbf{if}\;j \leq -3.3 \cdot 10^{-47}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;j \leq -1.02 \cdot 10^{-168}:\\
\;\;\;\;a \cdot \left(-1 \cdot \left(t \cdot x\right)\right)\\

\mathbf{elif}\;j \leq 3.3 \cdot 10^{-93}:\\
\;\;\;\;b \cdot \left(-1 \cdot \left(c \cdot z\right)\right)\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if j < -3.30000000000000004e-47 or 3.3000000000000001e-93 < j

    1. Initial program 74.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. 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)} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(j, a \cdot c - i \cdot y, x \cdot \left(y \cdot z - a \cdot t\right)\right) \]
      8. lower-*.f6461.4%

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

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

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

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

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

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) \]
      4. lower-*.f6438.9%

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) \]
    7. Applied rewrites38.9%

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

    if -3.30000000000000004e-47 < j < -1.01999999999999999e-168

    1. Initial program 74.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. Taylor expanded in a around inf

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

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

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

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot \color{blue}{x}, c \cdot j\right) \]
      4. lower-*.f6440.0%

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot x, c \cdot j\right) \]
    4. Applied rewrites40.0%

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

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

        \[\leadsto a \cdot \left(-1 \cdot \left(t \cdot \color{blue}{x}\right)\right) \]
      2. lower-*.f6422.8%

        \[\leadsto a \cdot \left(-1 \cdot \left(t \cdot x\right)\right) \]
    7. Applied rewrites22.8%

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

    if -1.01999999999999999e-168 < j < 3.3000000000000001e-93

    1. Initial program 74.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. Taylor expanded in b around inf

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

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

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

        \[\leadsto b \cdot \left(i \cdot t - \color{blue}{c} \cdot z\right) \]
      4. lower-*.f6438.6%

        \[\leadsto b \cdot \left(i \cdot t - c \cdot \color{blue}{z}\right) \]
    4. Applied rewrites38.6%

      \[\leadsto \color{blue}{b \cdot \left(i \cdot t - c \cdot z\right)} \]
    5. Taylor expanded in z around inf

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

        \[\leadsto b \cdot \left(-1 \cdot \left(c \cdot \color{blue}{z}\right)\right) \]
      2. lower-*.f6422.1%

        \[\leadsto b \cdot \left(-1 \cdot \left(c \cdot z\right)\right) \]
    7. Applied rewrites22.1%

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

Alternative 9: 30.4% accurate, 1.4× speedup?

\[\begin{array}{l} t_1 := b \cdot \left(i \cdot t\right)\\ \mathbf{if}\;b \leq -1.26 \cdot 10^{+262}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq -3 \cdot 10^{+19}:\\ \;\;\;\;b \cdot \left(-1 \cdot \left(c \cdot z\right)\right)\\ \mathbf{elif}\;b \leq -1.85 \cdot 10^{-270}:\\ \;\;\;\;a \cdot \left(c \cdot j\right)\\ \mathbf{elif}\;b \leq 1.8 \cdot 10^{+90}:\\ \;\;\;\;a \cdot \left(-1 \cdot \left(t \cdot x\right)\right)\\ \mathbf{elif}\;b \leq 4.6 \cdot 10^{+137}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-1 \cdot \left(b \cdot c\right)\right)\\ \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* b (* i t))))
   (if (<= b -1.26e+262)
     t_1
     (if (<= b -3e+19)
       (* b (* -1.0 (* c z)))
       (if (<= b -1.85e-270)
         (* a (* c j))
         (if (<= b 1.8e+90)
           (* a (* -1.0 (* t x)))
           (if (<= b 4.6e+137) t_1 (* z (* -1.0 (* b c))))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = b * (i * t);
	double tmp;
	if (b <= -1.26e+262) {
		tmp = t_1;
	} else if (b <= -3e+19) {
		tmp = b * (-1.0 * (c * z));
	} else if (b <= -1.85e-270) {
		tmp = a * (c * j);
	} else if (b <= 1.8e+90) {
		tmp = a * (-1.0 * (t * x));
	} else if (b <= 4.6e+137) {
		tmp = t_1;
	} else {
		tmp = z * (-1.0 * (b * c));
	}
	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) :: tmp
    t_1 = b * (i * t)
    if (b <= (-1.26d+262)) then
        tmp = t_1
    else if (b <= (-3d+19)) then
        tmp = b * ((-1.0d0) * (c * z))
    else if (b <= (-1.85d-270)) then
        tmp = a * (c * j)
    else if (b <= 1.8d+90) then
        tmp = a * ((-1.0d0) * (t * x))
    else if (b <= 4.6d+137) then
        tmp = t_1
    else
        tmp = z * ((-1.0d0) * (b * c))
    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 = b * (i * t);
	double tmp;
	if (b <= -1.26e+262) {
		tmp = t_1;
	} else if (b <= -3e+19) {
		tmp = b * (-1.0 * (c * z));
	} else if (b <= -1.85e-270) {
		tmp = a * (c * j);
	} else if (b <= 1.8e+90) {
		tmp = a * (-1.0 * (t * x));
	} else if (b <= 4.6e+137) {
		tmp = t_1;
	} else {
		tmp = z * (-1.0 * (b * c));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j):
	t_1 = b * (i * t)
	tmp = 0
	if b <= -1.26e+262:
		tmp = t_1
	elif b <= -3e+19:
		tmp = b * (-1.0 * (c * z))
	elif b <= -1.85e-270:
		tmp = a * (c * j)
	elif b <= 1.8e+90:
		tmp = a * (-1.0 * (t * x))
	elif b <= 4.6e+137:
		tmp = t_1
	else:
		tmp = z * (-1.0 * (b * c))
	return tmp
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(b * Float64(i * t))
	tmp = 0.0
	if (b <= -1.26e+262)
		tmp = t_1;
	elseif (b <= -3e+19)
		tmp = Float64(b * Float64(-1.0 * Float64(c * z)));
	elseif (b <= -1.85e-270)
		tmp = Float64(a * Float64(c * j));
	elseif (b <= 1.8e+90)
		tmp = Float64(a * Float64(-1.0 * Float64(t * x)));
	elseif (b <= 4.6e+137)
		tmp = t_1;
	else
		tmp = Float64(z * Float64(-1.0 * Float64(b * c)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j)
	t_1 = b * (i * t);
	tmp = 0.0;
	if (b <= -1.26e+262)
		tmp = t_1;
	elseif (b <= -3e+19)
		tmp = b * (-1.0 * (c * z));
	elseif (b <= -1.85e-270)
		tmp = a * (c * j);
	elseif (b <= 1.8e+90)
		tmp = a * (-1.0 * (t * x));
	elseif (b <= 4.6e+137)
		tmp = t_1;
	else
		tmp = z * (-1.0 * (b * c));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(b * N[(i * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.26e+262], t$95$1, If[LessEqual[b, -3e+19], N[(b * N[(-1.0 * N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -1.85e-270], N[(a * N[(c * j), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.8e+90], N[(a * N[(-1.0 * N[(t * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.6e+137], t$95$1, N[(z * N[(-1.0 * N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_1 := b \cdot \left(i \cdot t\right)\\
\mathbf{if}\;b \leq -1.26 \cdot 10^{+262}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq -3 \cdot 10^{+19}:\\
\;\;\;\;b \cdot \left(-1 \cdot \left(c \cdot z\right)\right)\\

\mathbf{elif}\;b \leq -1.85 \cdot 10^{-270}:\\
\;\;\;\;a \cdot \left(c \cdot j\right)\\

\mathbf{elif}\;b \leq 1.8 \cdot 10^{+90}:\\
\;\;\;\;a \cdot \left(-1 \cdot \left(t \cdot x\right)\right)\\

\mathbf{elif}\;b \leq 4.6 \cdot 10^{+137}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;z \cdot \left(-1 \cdot \left(b \cdot c\right)\right)\\


\end{array}
Derivation
  1. Split input into 5 regimes
  2. if b < -1.26000000000000004e262 or 1.8e90 < b < 4.59999999999999999e137

    1. Initial program 74.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. Taylor expanded in b around inf

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

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

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

        \[\leadsto b \cdot \left(i \cdot t - \color{blue}{c} \cdot z\right) \]
      4. lower-*.f6438.6%

        \[\leadsto b \cdot \left(i \cdot t - c \cdot \color{blue}{z}\right) \]
    4. Applied rewrites38.6%

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

      \[\leadsto b \cdot \left(i \cdot \color{blue}{t}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6421.7%

        \[\leadsto b \cdot \left(i \cdot t\right) \]
    7. Applied rewrites21.7%

      \[\leadsto b \cdot \left(i \cdot \color{blue}{t}\right) \]

    if -1.26000000000000004e262 < b < -3e19

    1. Initial program 74.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. Taylor expanded in b around inf

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

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

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

        \[\leadsto b \cdot \left(i \cdot t - \color{blue}{c} \cdot z\right) \]
      4. lower-*.f6438.6%

        \[\leadsto b \cdot \left(i \cdot t - c \cdot \color{blue}{z}\right) \]
    4. Applied rewrites38.6%

      \[\leadsto \color{blue}{b \cdot \left(i \cdot t - c \cdot z\right)} \]
    5. Taylor expanded in z around inf

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

        \[\leadsto b \cdot \left(-1 \cdot \left(c \cdot \color{blue}{z}\right)\right) \]
      2. lower-*.f6422.1%

        \[\leadsto b \cdot \left(-1 \cdot \left(c \cdot z\right)\right) \]
    7. Applied rewrites22.1%

      \[\leadsto b \cdot \left(-1 \cdot \color{blue}{\left(c \cdot z\right)}\right) \]

    if -3e19 < b < -1.8500000000000001e-270

    1. Initial program 74.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. Taylor expanded in a around inf

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

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

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

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot \color{blue}{x}, c \cdot j\right) \]
      4. lower-*.f6440.0%

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot x, c \cdot j\right) \]
    4. Applied rewrites40.0%

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

      \[\leadsto a \cdot \left(c \cdot \color{blue}{j}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6422.5%

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

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

    if -1.8500000000000001e-270 < b < 1.8e90

    1. Initial program 74.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. Taylor expanded in a around inf

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

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

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

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot \color{blue}{x}, c \cdot j\right) \]
      4. lower-*.f6440.0%

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot x, c \cdot j\right) \]
    4. Applied rewrites40.0%

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

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

        \[\leadsto a \cdot \left(-1 \cdot \left(t \cdot \color{blue}{x}\right)\right) \]
      2. lower-*.f6422.8%

        \[\leadsto a \cdot \left(-1 \cdot \left(t \cdot x\right)\right) \]
    7. Applied rewrites22.8%

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

    if 4.59999999999999999e137 < b

    1. Initial program 74.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. Taylor expanded in z around inf

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

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

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

        \[\leadsto z \cdot \left(x \cdot y - \color{blue}{b} \cdot c\right) \]
      4. lower-*.f6438.5%

        \[\leadsto z \cdot \left(x \cdot y - b \cdot \color{blue}{c}\right) \]
    4. Applied rewrites38.5%

      \[\leadsto \color{blue}{z \cdot \left(x \cdot y - b \cdot c\right)} \]
    5. Taylor expanded in x around 0

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

        \[\leadsto z \cdot \left(-1 \cdot \left(b \cdot \color{blue}{c}\right)\right) \]
      2. lower-*.f6421.9%

        \[\leadsto z \cdot \left(-1 \cdot \left(b \cdot c\right)\right) \]
    7. Applied rewrites21.9%

      \[\leadsto z \cdot \left(-1 \cdot \color{blue}{\left(b \cdot c\right)}\right) \]
  3. Recombined 5 regimes into one program.
  4. Add Preprocessing

Alternative 10: 29.6% accurate, 1.4× speedup?

\[\begin{array}{l} t_1 := b \cdot \left(-1 \cdot \left(c \cdot z\right)\right)\\ t_2 := b \cdot \left(i \cdot t\right)\\ \mathbf{if}\;b \leq -1.26 \cdot 10^{+262}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;b \leq -3 \cdot 10^{+19}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq -1.85 \cdot 10^{-270}:\\ \;\;\;\;a \cdot \left(c \cdot j\right)\\ \mathbf{elif}\;b \leq 1.8 \cdot 10^{+90}:\\ \;\;\;\;a \cdot \left(-1 \cdot \left(t \cdot x\right)\right)\\ \mathbf{elif}\;b \leq 7.8 \cdot 10^{+142}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* b (* -1.0 (* c z)))) (t_2 (* b (* i t))))
   (if (<= b -1.26e+262)
     t_2
     (if (<= b -3e+19)
       t_1
       (if (<= b -1.85e-270)
         (* a (* c j))
         (if (<= b 1.8e+90)
           (* a (* -1.0 (* t x)))
           (if (<= b 7.8e+142) t_2 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 = b * (-1.0 * (c * z));
	double t_2 = b * (i * t);
	double tmp;
	if (b <= -1.26e+262) {
		tmp = t_2;
	} else if (b <= -3e+19) {
		tmp = t_1;
	} else if (b <= -1.85e-270) {
		tmp = a * (c * j);
	} else if (b <= 1.8e+90) {
		tmp = a * (-1.0 * (t * x));
	} else if (b <= 7.8e+142) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, 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 = b * ((-1.0d0) * (c * z))
    t_2 = b * (i * t)
    if (b <= (-1.26d+262)) then
        tmp = t_2
    else if (b <= (-3d+19)) then
        tmp = t_1
    else if (b <= (-1.85d-270)) then
        tmp = a * (c * j)
    else if (b <= 1.8d+90) then
        tmp = a * ((-1.0d0) * (t * x))
    else if (b <= 7.8d+142) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = b * (-1.0 * (c * z));
	double t_2 = b * (i * t);
	double tmp;
	if (b <= -1.26e+262) {
		tmp = t_2;
	} else if (b <= -3e+19) {
		tmp = t_1;
	} else if (b <= -1.85e-270) {
		tmp = a * (c * j);
	} else if (b <= 1.8e+90) {
		tmp = a * (-1.0 * (t * x));
	} else if (b <= 7.8e+142) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j):
	t_1 = b * (-1.0 * (c * z))
	t_2 = b * (i * t)
	tmp = 0
	if b <= -1.26e+262:
		tmp = t_2
	elif b <= -3e+19:
		tmp = t_1
	elif b <= -1.85e-270:
		tmp = a * (c * j)
	elif b <= 1.8e+90:
		tmp = a * (-1.0 * (t * x))
	elif b <= 7.8e+142:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(b * Float64(-1.0 * Float64(c * z)))
	t_2 = Float64(b * Float64(i * t))
	tmp = 0.0
	if (b <= -1.26e+262)
		tmp = t_2;
	elseif (b <= -3e+19)
		tmp = t_1;
	elseif (b <= -1.85e-270)
		tmp = Float64(a * Float64(c * j));
	elseif (b <= 1.8e+90)
		tmp = Float64(a * Float64(-1.0 * Float64(t * x)));
	elseif (b <= 7.8e+142)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j)
	t_1 = b * (-1.0 * (c * z));
	t_2 = b * (i * t);
	tmp = 0.0;
	if (b <= -1.26e+262)
		tmp = t_2;
	elseif (b <= -3e+19)
		tmp = t_1;
	elseif (b <= -1.85e-270)
		tmp = a * (c * j);
	elseif (b <= 1.8e+90)
		tmp = a * (-1.0 * (t * x));
	elseif (b <= 7.8e+142)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(b * N[(-1.0 * N[(c * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * N[(i * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.26e+262], t$95$2, If[LessEqual[b, -3e+19], t$95$1, If[LessEqual[b, -1.85e-270], N[(a * N[(c * j), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.8e+90], N[(a * N[(-1.0 * N[(t * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.8e+142], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
t_1 := b \cdot \left(-1 \cdot \left(c \cdot z\right)\right)\\
t_2 := b \cdot \left(i \cdot t\right)\\
\mathbf{if}\;b \leq -1.26 \cdot 10^{+262}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;b \leq -3 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq -1.85 \cdot 10^{-270}:\\
\;\;\;\;a \cdot \left(c \cdot j\right)\\

\mathbf{elif}\;b \leq 1.8 \cdot 10^{+90}:\\
\;\;\;\;a \cdot \left(-1 \cdot \left(t \cdot x\right)\right)\\

\mathbf{elif}\;b \leq 7.8 \cdot 10^{+142}:\\
\;\;\;\;t\_2\\

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


\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -1.26000000000000004e262 or 1.8e90 < b < 7.8000000000000001e142

    1. Initial program 74.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. Taylor expanded in b around inf

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

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

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

        \[\leadsto b \cdot \left(i \cdot t - \color{blue}{c} \cdot z\right) \]
      4. lower-*.f6438.6%

        \[\leadsto b \cdot \left(i \cdot t - c \cdot \color{blue}{z}\right) \]
    4. Applied rewrites38.6%

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

      \[\leadsto b \cdot \left(i \cdot \color{blue}{t}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6421.7%

        \[\leadsto b \cdot \left(i \cdot t\right) \]
    7. Applied rewrites21.7%

      \[\leadsto b \cdot \left(i \cdot \color{blue}{t}\right) \]

    if -1.26000000000000004e262 < b < -3e19 or 7.8000000000000001e142 < b

    1. Initial program 74.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. Taylor expanded in b around inf

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

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

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

        \[\leadsto b \cdot \left(i \cdot t - \color{blue}{c} \cdot z\right) \]
      4. lower-*.f6438.6%

        \[\leadsto b \cdot \left(i \cdot t - c \cdot \color{blue}{z}\right) \]
    4. Applied rewrites38.6%

      \[\leadsto \color{blue}{b \cdot \left(i \cdot t - c \cdot z\right)} \]
    5. Taylor expanded in z around inf

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

        \[\leadsto b \cdot \left(-1 \cdot \left(c \cdot \color{blue}{z}\right)\right) \]
      2. lower-*.f6422.1%

        \[\leadsto b \cdot \left(-1 \cdot \left(c \cdot z\right)\right) \]
    7. Applied rewrites22.1%

      \[\leadsto b \cdot \left(-1 \cdot \color{blue}{\left(c \cdot z\right)}\right) \]

    if -3e19 < b < -1.8500000000000001e-270

    1. Initial program 74.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. Taylor expanded in a around inf

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

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

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

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot \color{blue}{x}, c \cdot j\right) \]
      4. lower-*.f6440.0%

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot x, c \cdot j\right) \]
    4. Applied rewrites40.0%

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

      \[\leadsto a \cdot \left(c \cdot \color{blue}{j}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6422.5%

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

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

    if -1.8500000000000001e-270 < b < 1.8e90

    1. Initial program 74.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. Taylor expanded in a around inf

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

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

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

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot \color{blue}{x}, c \cdot j\right) \]
      4. lower-*.f6440.0%

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot x, c \cdot j\right) \]
    4. Applied rewrites40.0%

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

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

        \[\leadsto a \cdot \left(-1 \cdot \left(t \cdot \color{blue}{x}\right)\right) \]
      2. lower-*.f6422.8%

        \[\leadsto a \cdot \left(-1 \cdot \left(t \cdot x\right)\right) \]
    7. Applied rewrites22.8%

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

Alternative 11: 29.5% accurate, 1.9× speedup?

\[\begin{array}{l} t_1 := b \cdot \left(i \cdot t\right)\\ \mathbf{if}\;b \leq -1.65 \cdot 10^{+194}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq -1.85 \cdot 10^{-270}:\\ \;\;\;\;a \cdot \left(c \cdot j\right)\\ \mathbf{elif}\;b \leq 1.8 \cdot 10^{+90}:\\ \;\;\;\;a \cdot \left(-1 \cdot \left(t \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* b (* i t))))
   (if (<= b -1.65e+194)
     t_1
     (if (<= b -1.85e-270)
       (* a (* c j))
       (if (<= b 1.8e+90) (* a (* -1.0 (* t 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 = b * (i * t);
	double tmp;
	if (b <= -1.65e+194) {
		tmp = t_1;
	} else if (b <= -1.85e-270) {
		tmp = a * (c * j);
	} else if (b <= 1.8e+90) {
		tmp = a * (-1.0 * (t * x));
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, 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) :: tmp
    t_1 = b * (i * t)
    if (b <= (-1.65d+194)) then
        tmp = t_1
    else if (b <= (-1.85d-270)) then
        tmp = a * (c * j)
    else if (b <= 1.8d+90) then
        tmp = a * ((-1.0d0) * (t * x))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = b * (i * t);
	double tmp;
	if (b <= -1.65e+194) {
		tmp = t_1;
	} else if (b <= -1.85e-270) {
		tmp = a * (c * j);
	} else if (b <= 1.8e+90) {
		tmp = a * (-1.0 * (t * x));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j):
	t_1 = b * (i * t)
	tmp = 0
	if b <= -1.65e+194:
		tmp = t_1
	elif b <= -1.85e-270:
		tmp = a * (c * j)
	elif b <= 1.8e+90:
		tmp = a * (-1.0 * (t * x))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(b * Float64(i * t))
	tmp = 0.0
	if (b <= -1.65e+194)
		tmp = t_1;
	elseif (b <= -1.85e-270)
		tmp = Float64(a * Float64(c * j));
	elseif (b <= 1.8e+90)
		tmp = Float64(a * Float64(-1.0 * Float64(t * x)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j)
	t_1 = b * (i * t);
	tmp = 0.0;
	if (b <= -1.65e+194)
		tmp = t_1;
	elseif (b <= -1.85e-270)
		tmp = a * (c * j);
	elseif (b <= 1.8e+90)
		tmp = a * (-1.0 * (t * x));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(b * N[(i * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.65e+194], t$95$1, If[LessEqual[b, -1.85e-270], N[(a * N[(c * j), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.8e+90], N[(a * N[(-1.0 * N[(t * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := b \cdot \left(i \cdot t\right)\\
\mathbf{if}\;b \leq -1.65 \cdot 10^{+194}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq -1.85 \cdot 10^{-270}:\\
\;\;\;\;a \cdot \left(c \cdot j\right)\\

\mathbf{elif}\;b \leq 1.8 \cdot 10^{+90}:\\
\;\;\;\;a \cdot \left(-1 \cdot \left(t \cdot x\right)\right)\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -1.64999999999999992e194 or 1.8e90 < b

    1. Initial program 74.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. Taylor expanded in b around inf

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

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

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

        \[\leadsto b \cdot \left(i \cdot t - \color{blue}{c} \cdot z\right) \]
      4. lower-*.f6438.6%

        \[\leadsto b \cdot \left(i \cdot t - c \cdot \color{blue}{z}\right) \]
    4. Applied rewrites38.6%

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

      \[\leadsto b \cdot \left(i \cdot \color{blue}{t}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6421.7%

        \[\leadsto b \cdot \left(i \cdot t\right) \]
    7. Applied rewrites21.7%

      \[\leadsto b \cdot \left(i \cdot \color{blue}{t}\right) \]

    if -1.64999999999999992e194 < b < -1.8500000000000001e-270

    1. Initial program 74.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. Taylor expanded in a around inf

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

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

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

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot \color{blue}{x}, c \cdot j\right) \]
      4. lower-*.f6440.0%

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot x, c \cdot j\right) \]
    4. Applied rewrites40.0%

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

      \[\leadsto a \cdot \left(c \cdot \color{blue}{j}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6422.5%

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

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

    if -1.8500000000000001e-270 < b < 1.8e90

    1. Initial program 74.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. Taylor expanded in a around inf

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

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

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

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot \color{blue}{x}, c \cdot j\right) \]
      4. lower-*.f6440.0%

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot x, c \cdot j\right) \]
    4. Applied rewrites40.0%

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

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

        \[\leadsto a \cdot \left(-1 \cdot \left(t \cdot \color{blue}{x}\right)\right) \]
      2. lower-*.f6422.8%

        \[\leadsto a \cdot \left(-1 \cdot \left(t \cdot x\right)\right) \]
    7. Applied rewrites22.8%

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

Alternative 12: 27.9% accurate, 2.8× speedup?

\[\begin{array}{l} t_1 := a \cdot \left(c \cdot j\right)\\ \mathbf{if}\;c \leq -2.3 \cdot 10^{+16}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;c \leq 8.3 \cdot 10^{+18}:\\ \;\;\;\;b \cdot \left(i \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* a (* c j))))
   (if (<= c -2.3e+16) t_1 (if (<= c 8.3e+18) (* b (* i t)) 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 = a * (c * j);
	double tmp;
	if (c <= -2.3e+16) {
		tmp = t_1;
	} else if (c <= 8.3e+18) {
		tmp = b * (i * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, 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) :: tmp
    t_1 = a * (c * j)
    if (c <= (-2.3d+16)) then
        tmp = t_1
    else if (c <= 8.3d+18) then
        tmp = b * (i * t)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = a * (c * j);
	double tmp;
	if (c <= -2.3e+16) {
		tmp = t_1;
	} else if (c <= 8.3e+18) {
		tmp = b * (i * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i, j):
	t_1 = a * (c * j)
	tmp = 0
	if c <= -2.3e+16:
		tmp = t_1
	elif c <= 8.3e+18:
		tmp = b * (i * t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(a * Float64(c * j))
	tmp = 0.0
	if (c <= -2.3e+16)
		tmp = t_1;
	elseif (c <= 8.3e+18)
		tmp = Float64(b * Float64(i * t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i, j)
	t_1 = a * (c * j);
	tmp = 0.0;
	if (c <= -2.3e+16)
		tmp = t_1;
	elseif (c <= 8.3e+18)
		tmp = b * (i * t);
	else
		tmp = t_1;
	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]}, If[LessEqual[c, -2.3e+16], t$95$1, If[LessEqual[c, 8.3e+18], N[(b * N[(i * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := a \cdot \left(c \cdot j\right)\\
\mathbf{if}\;c \leq -2.3 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;c \leq 8.3 \cdot 10^{+18}:\\
\;\;\;\;b \cdot \left(i \cdot t\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -2.3e16 or 8.3e18 < c

    1. Initial program 74.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. Taylor expanded in a around inf

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

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

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

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot \color{blue}{x}, c \cdot j\right) \]
      4. lower-*.f6440.0%

        \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot x, c \cdot j\right) \]
    4. Applied rewrites40.0%

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

      \[\leadsto a \cdot \left(c \cdot \color{blue}{j}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6422.5%

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

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

    if -2.3e16 < c < 8.3e18

    1. Initial program 74.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. Taylor expanded in b around inf

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

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

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

        \[\leadsto b \cdot \left(i \cdot t - \color{blue}{c} \cdot z\right) \]
      4. lower-*.f6438.6%

        \[\leadsto b \cdot \left(i \cdot t - c \cdot \color{blue}{z}\right) \]
    4. Applied rewrites38.6%

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

      \[\leadsto b \cdot \left(i \cdot \color{blue}{t}\right) \]
    6. Step-by-step derivation
      1. lower-*.f6421.7%

        \[\leadsto b \cdot \left(i \cdot t\right) \]
    7. Applied rewrites21.7%

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

Alternative 13: 22.5% accurate, 5.9× speedup?

\[a \cdot \left(c \cdot j\right) \]
(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]
a \cdot \left(c \cdot j\right)
Derivation
  1. Initial program 74.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. Taylor expanded in a around inf

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

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

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

      \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot \color{blue}{x}, c \cdot j\right) \]
    4. lower-*.f6440.0%

      \[\leadsto a \cdot \mathsf{fma}\left(-1, t \cdot x, c \cdot j\right) \]
  4. Applied rewrites40.0%

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

    \[\leadsto a \cdot \left(c \cdot \color{blue}{j}\right) \]
  6. Step-by-step derivation
    1. lower-*.f6422.5%

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

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

Reproduce

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