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

Percentage Accurate: 90.9% → 97.1%
Time: 8.7s
Alternatives: 8
Speedup: 0.4×

Specification

?
\[\begin{array}{l} \\ \frac{x \cdot y - z \cdot t}{a} \end{array} \]
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
	return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
	return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a):
	return ((x * y) - (z * t)) / a
function code(x, y, z, t, a)
	return Float64(Float64(Float64(x * y) - Float64(z * t)) / a)
end
function tmp = code(x, y, z, t, a)
	tmp = ((x * y) - (z * t)) / a;
end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 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: 90.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x \cdot y - z \cdot t}{a} \end{array} \]
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
	return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
	return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a):
	return ((x * y) - (z * t)) / a
function code(x, y, z, t, a)
	return Float64(Float64(Float64(x * y) - Float64(z * t)) / a)
end
function tmp = code(x, y, z, t, a)
	tmp = ((x * y) - (z * t)) / a;
end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}

Alternative 1: 97.1% accurate, 0.3× speedup?

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;\frac{t\_2}{a}\\

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


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

    1. Initial program 60.4%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub53.5%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. associate-/l*77.4%

        \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} - \frac{z \cdot t}{a} \]
      3. associate-/l*88.3%

        \[\leadsto \frac{x}{\frac{a}{y}} - \color{blue}{\frac{z}{\frac{a}{t}}} \]
    4. Applied egg-rr88.3%

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}} \]
    5. Step-by-step derivation
      1. associate-/r/90.5%

        \[\leadsto \color{blue}{\frac{x}{a} \cdot y} - \frac{z}{\frac{a}{t}} \]
    6. Applied egg-rr90.5%

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

    if -4.9999999999999998e290 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.99999999999999997e307

    1. Initial program 98.6%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing

    if 1.99999999999999997e307 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 53.4%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub50.3%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. associate-/l*64.7%

        \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} - \frac{z \cdot t}{a} \]
      3. associate-/l*87.6%

        \[\leadsto \frac{x}{\frac{a}{y}} - \color{blue}{\frac{z}{\frac{a}{t}}} \]
    4. Applied egg-rr87.6%

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}} \]
    5. Step-by-step derivation
      1. associate-/r/84.6%

        \[\leadsto \color{blue}{\frac{x}{a} \cdot y} - \frac{z}{\frac{a}{t}} \]
    6. Applied egg-rr84.6%

      \[\leadsto \color{blue}{\frac{x}{a} \cdot y} - \frac{z}{\frac{a}{t}} \]
    7. Step-by-step derivation
      1. associate-/r/87.7%

        \[\leadsto \frac{x}{a} \cdot y - \color{blue}{\frac{z}{a} \cdot t} \]
    8. Applied egg-rr87.7%

      \[\leadsto \frac{x}{a} \cdot y - \color{blue}{\frac{z}{a} \cdot t} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification95.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \leq -5 \cdot 10^{+290}:\\ \;\;\;\;y \cdot \frac{x}{a} - \frac{z}{\frac{a}{t}}\\ \mathbf{elif}\;x \cdot y - z \cdot t \leq 2 \cdot 10^{+307}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 72.5% accurate, 0.2× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := z \cdot \frac{-t}{a}\\ t_2 := \frac{x \cdot y}{a}\\ t_3 := x \cdot \frac{y}{a}\\ \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+94}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{+57}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -200000000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-124}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+240}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* z (/ (- t) a))) (t_2 (/ (* x y) a)) (t_3 (* x (/ y a))))
   (if (<= (* x y) -2e+94)
     t_3
     (if (<= (* x y) -1e+57)
       t_1
       (if (<= (* x y) -200000000000.0)
         t_2
         (if (<= (* x y) 2e-124) t_1 (if (<= (* x y) 5e+240) t_2 t_3)))))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double t_1 = z * (-t / a);
	double t_2 = (x * y) / a;
	double t_3 = x * (y / a);
	double tmp;
	if ((x * y) <= -2e+94) {
		tmp = t_3;
	} else if ((x * y) <= -1e+57) {
		tmp = t_1;
	} else if ((x * y) <= -200000000000.0) {
		tmp = t_2;
	} else if ((x * y) <= 2e-124) {
		tmp = t_1;
	} else if ((x * y) <= 5e+240) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = z * (-t / a)
    t_2 = (x * y) / a
    t_3 = x * (y / a)
    if ((x * y) <= (-2d+94)) then
        tmp = t_3
    else if ((x * y) <= (-1d+57)) then
        tmp = t_1
    else if ((x * y) <= (-200000000000.0d0)) then
        tmp = t_2
    else if ((x * y) <= 2d-124) then
        tmp = t_1
    else if ((x * y) <= 5d+240) then
        tmp = t_2
    else
        tmp = t_3
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = z * (-t / a);
	double t_2 = (x * y) / a;
	double t_3 = x * (y / a);
	double tmp;
	if ((x * y) <= -2e+94) {
		tmp = t_3;
	} else if ((x * y) <= -1e+57) {
		tmp = t_1;
	} else if ((x * y) <= -200000000000.0) {
		tmp = t_2;
	} else if ((x * y) <= 2e-124) {
		tmp = t_1;
	} else if ((x * y) <= 5e+240) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a])
def code(x, y, z, t, a):
	t_1 = z * (-t / a)
	t_2 = (x * y) / a
	t_3 = x * (y / a)
	tmp = 0
	if (x * y) <= -2e+94:
		tmp = t_3
	elif (x * y) <= -1e+57:
		tmp = t_1
	elif (x * y) <= -200000000000.0:
		tmp = t_2
	elif (x * y) <= 2e-124:
		tmp = t_1
	elif (x * y) <= 5e+240:
		tmp = t_2
	else:
		tmp = t_3
	return tmp
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	t_1 = Float64(z * Float64(Float64(-t) / a))
	t_2 = Float64(Float64(x * y) / a)
	t_3 = Float64(x * Float64(y / a))
	tmp = 0.0
	if (Float64(x * y) <= -2e+94)
		tmp = t_3;
	elseif (Float64(x * y) <= -1e+57)
		tmp = t_1;
	elseif (Float64(x * y) <= -200000000000.0)
		tmp = t_2;
	elseif (Float64(x * y) <= 2e-124)
		tmp = t_1;
	elseif (Float64(x * y) <= 5e+240)
		tmp = t_2;
	else
		tmp = t_3;
	end
	return tmp
end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
	t_1 = z * (-t / a);
	t_2 = (x * y) / a;
	t_3 = x * (y / a);
	tmp = 0.0;
	if ((x * y) <= -2e+94)
		tmp = t_3;
	elseif ((x * y) <= -1e+57)
		tmp = t_1;
	elseif ((x * y) <= -200000000000.0)
		tmp = t_2;
	elseif ((x * y) <= 2e-124)
		tmp = t_1;
	elseif ((x * y) <= 5e+240)
		tmp = t_2;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+94], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], -1e+57], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -200000000000.0], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 2e-124], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e+240], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := z \cdot \frac{-t}{a}\\
t_2 := \frac{x \cdot y}{a}\\
t_3 := x \cdot \frac{y}{a}\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+94}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq -200000000000:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-124}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+240}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2e94 or 5.0000000000000003e240 < (*.f64 x y)

    1. Initial program 72.8%

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

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

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

      \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    6. Taylor expanded in x around 0 72.9%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    7. Step-by-step derivation
      1. *-commutative72.9%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} \]
      2. associate-*l/93.4%

        \[\leadsto \color{blue}{\frac{y}{a} \cdot x} \]
      3. *-commutative93.4%

        \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
    8. Simplified93.4%

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

    if -2e94 < (*.f64 x y) < -1.00000000000000005e57 or -2e11 < (*.f64 x y) < 1.99999999999999987e-124

    1. Initial program 90.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
    4. Step-by-step derivation
      1. mul-1-neg76.6%

        \[\leadsto \color{blue}{-\frac{t \cdot z}{a}} \]
      2. associate-/l*77.6%

        \[\leadsto -\color{blue}{\frac{t}{\frac{a}{z}}} \]
    5. Simplified77.6%

      \[\leadsto \color{blue}{-\frac{t}{\frac{a}{z}}} \]
    6. Step-by-step derivation
      1. associate-/r/78.4%

        \[\leadsto -\color{blue}{\frac{t}{a} \cdot z} \]
    7. Applied egg-rr78.4%

      \[\leadsto -\color{blue}{\frac{t}{a} \cdot z} \]

    if -1.00000000000000005e57 < (*.f64 x y) < -2e11 or 1.99999999999999987e-124 < (*.f64 x y) < 5.0000000000000003e240

    1. Initial program 94.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+94}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{+57}:\\ \;\;\;\;z \cdot \frac{-t}{a}\\ \mathbf{elif}\;x \cdot y \leq -200000000000:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-124}:\\ \;\;\;\;z \cdot \frac{-t}{a}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+240}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 72.6% accurate, 0.2× speedup?

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

\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{+57}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\

\mathbf{elif}\;x \cdot y \leq -200000000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-124}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\

\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+240}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -2e94 or 5.0000000000000003e240 < (*.f64 x y)

    1. Initial program 72.8%

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

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

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

      \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    6. Taylor expanded in x around 0 72.9%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    7. Step-by-step derivation
      1. *-commutative72.9%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} \]
      2. associate-*l/93.4%

        \[\leadsto \color{blue}{\frac{y}{a} \cdot x} \]
      3. *-commutative93.4%

        \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
    8. Simplified93.4%

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

    if -2e94 < (*.f64 x y) < -1.00000000000000005e57

    1. Initial program 90.9%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
    4. Step-by-step derivation
      1. mul-1-neg73.4%

        \[\leadsto \color{blue}{-\frac{t \cdot z}{a}} \]
      2. associate-/l*82.4%

        \[\leadsto -\color{blue}{\frac{t}{\frac{a}{z}}} \]
    5. Simplified82.4%

      \[\leadsto \color{blue}{-\frac{t}{\frac{a}{z}}} \]
    6. Step-by-step derivation
      1. associate-/r/73.6%

        \[\leadsto -\color{blue}{\frac{t}{a} \cdot z} \]
    7. Applied egg-rr73.6%

      \[\leadsto -\color{blue}{\frac{t}{a} \cdot z} \]

    if -1.00000000000000005e57 < (*.f64 x y) < -2e11 or 1.99999999999999987e-124 < (*.f64 x y) < 5.0000000000000003e240

    1. Initial program 94.4%

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

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

    if -2e11 < (*.f64 x y) < 1.99999999999999987e-124

    1. Initial program 90.1%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot z}{a}} \]
    4. Step-by-step derivation
      1. mul-1-neg77.0%

        \[\leadsto \color{blue}{-\frac{t \cdot z}{a}} \]
      2. associate-/l*77.1%

        \[\leadsto -\color{blue}{\frac{t}{\frac{a}{z}}} \]
    5. Simplified77.1%

      \[\leadsto \color{blue}{-\frac{t}{\frac{a}{z}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification80.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+94}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{+57}:\\ \;\;\;\;z \cdot \frac{-t}{a}\\ \mathbf{elif}\;x \cdot y \leq -200000000000:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-124}:\\ \;\;\;\;\frac{-t}{\frac{a}{z}}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+240}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 97.1% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} t_1 := x \cdot y - z \cdot t\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+290} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+307}\right):\\ \;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_1}{a}\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (* x y) (* z t))))
   (if (or (<= t_1 -5e+290) (not (<= t_1 2e+307)))
     (- (* y (/ x a)) (* t (/ z a)))
     (/ t_1 a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x * y) - (z * t);
	double tmp;
	if ((t_1 <= -5e+290) || !(t_1 <= 2e+307)) {
		tmp = (y * (x / a)) - (t * (z / a));
	} else {
		tmp = t_1 / a;
	}
	return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (x * y) - (z * t)
    if ((t_1 <= (-5d+290)) .or. (.not. (t_1 <= 2d+307))) then
        tmp = (y * (x / a)) - (t * (z / a))
    else
        tmp = t_1 / a
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (x * y) - (z * t);
	double tmp;
	if ((t_1 <= -5e+290) || !(t_1 <= 2e+307)) {
		tmp = (y * (x / a)) - (t * (z / a));
	} else {
		tmp = t_1 / a;
	}
	return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a])
def code(x, y, z, t, a):
	t_1 = (x * y) - (z * t)
	tmp = 0
	if (t_1 <= -5e+290) or not (t_1 <= 2e+307):
		tmp = (y * (x / a)) - (t * (z / a))
	else:
		tmp = t_1 / a
	return tmp
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if ((t_1 <= -5e+290) || !(t_1 <= 2e+307))
		tmp = Float64(Float64(y * Float64(x / a)) - Float64(t * Float64(z / a)));
	else
		tmp = Float64(t_1 / a);
	end
	return tmp
end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
	t_1 = (x * y) - (z * t);
	tmp = 0.0;
	if ((t_1 <= -5e+290) || ~((t_1 <= 2e+307)))
		tmp = (y * (x / a)) - (t * (z / a));
	else
		tmp = t_1 / a;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+290], N[Not[LessEqual[t$95$1, 2e+307]], $MachinePrecision]], N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+290} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+307}\right):\\
\;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999998e290 or 1.99999999999999997e307 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 57.4%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub52.1%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. associate-/l*71.9%

        \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} - \frac{z \cdot t}{a} \]
      3. associate-/l*88.0%

        \[\leadsto \frac{x}{\frac{a}{y}} - \color{blue}{\frac{z}{\frac{a}{t}}} \]
    4. Applied egg-rr88.0%

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}} \]
    5. Step-by-step derivation
      1. associate-/r/88.0%

        \[\leadsto \color{blue}{\frac{x}{a} \cdot y} - \frac{z}{\frac{a}{t}} \]
    6. Applied egg-rr88.0%

      \[\leadsto \color{blue}{\frac{x}{a} \cdot y} - \frac{z}{\frac{a}{t}} \]
    7. Step-by-step derivation
      1. associate-/r/90.6%

        \[\leadsto \frac{x}{a} \cdot y - \color{blue}{\frac{z}{a} \cdot t} \]
    8. Applied egg-rr90.6%

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

    if -4.9999999999999998e290 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.99999999999999997e307

    1. Initial program 98.6%

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

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

Alternative 5: 94.8% accurate, 0.4× speedup?

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

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


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

    1. Initial program 62.9%

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

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

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

      \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    6. Taylor expanded in x around 0 66.6%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    7. Step-by-step derivation
      1. *-commutative66.6%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} \]
      2. associate-*l/98.1%

        \[\leadsto \color{blue}{\frac{y}{a} \cdot x} \]
      3. *-commutative98.1%

        \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
    8. Simplified98.1%

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

    if -5.0000000000000002e265 < (*.f64 x y) < 4.9999999999999996e248

    1. Initial program 92.6%

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

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

Alternative 6: 51.8% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{-102}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= x -5e-102) (* y (/ x a)) (* x (/ y a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -5e-102) {
		tmp = y * (x / a);
	} else {
		tmp = x * (y / a);
	}
	return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (x <= (-5d-102)) then
        tmp = y * (x / a)
    else
        tmp = x * (y / a)
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -5e-102) {
		tmp = y * (x / a);
	} else {
		tmp = x * (y / a);
	}
	return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a])
def code(x, y, z, t, a):
	tmp = 0
	if x <= -5e-102:
		tmp = y * (x / a)
	else:
		tmp = x * (y / a)
	return tmp
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	tmp = 0.0
	if (x <= -5e-102)
		tmp = Float64(y * Float64(x / a));
	else
		tmp = Float64(x * Float64(y / a));
	end
	return tmp
end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (x <= -5e-102)
		tmp = y * (x / a);
	else
		tmp = x * (y / a);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -5e-102], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-102}:\\
\;\;\;\;y \cdot \frac{x}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.00000000000000026e-102

    1. Initial program 85.5%

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

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

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

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

    if -5.00000000000000026e-102 < x

    1. Initial program 86.8%

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

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

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

      \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    6. Taylor expanded in x around 0 46.7%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    7. Step-by-step derivation
      1. *-commutative46.7%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} \]
      2. associate-*l/49.9%

        \[\leadsto \color{blue}{\frac{y}{a} \cdot x} \]
      3. *-commutative49.9%

        \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
    8. Simplified49.9%

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

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

Alternative 7: 51.8% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -6.2 \cdot 10^{-102}:\\ \;\;\;\;\frac{y}{\frac{a}{x}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \end{array} \end{array} \]
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= x -6.2e-102) (/ y (/ a x)) (* x (/ y a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -6.2e-102) {
		tmp = y / (a / x);
	} else {
		tmp = x * (y / a);
	}
	return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (x <= (-6.2d-102)) then
        tmp = y / (a / x)
    else
        tmp = x * (y / a)
    end if
    code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -6.2e-102) {
		tmp = y / (a / x);
	} else {
		tmp = x * (y / a);
	}
	return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a])
def code(x, y, z, t, a):
	tmp = 0
	if x <= -6.2e-102:
		tmp = y / (a / x)
	else:
		tmp = x * (y / a)
	return tmp
x, y, z, t, a = sort([x, y, z, t, a])
function code(x, y, z, t, a)
	tmp = 0.0
	if (x <= -6.2e-102)
		tmp = Float64(y / Float64(a / x));
	else
		tmp = Float64(x * Float64(y / a));
	end
	return tmp
end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (x <= -6.2e-102)
		tmp = y / (a / x);
	else
		tmp = x * (y / a);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -6.2e-102], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{-102}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.20000000000000026e-102

    1. Initial program 85.5%

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

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

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

      \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    6. Step-by-step derivation
      1. *-commutative71.0%

        \[\leadsto \color{blue}{y \cdot \frac{x}{a}} \]
      2. clear-num71.0%

        \[\leadsto y \cdot \color{blue}{\frac{1}{\frac{a}{x}}} \]
      3. un-div-inv71.1%

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} \]
    7. Applied egg-rr71.1%

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

    if -6.20000000000000026e-102 < x

    1. Initial program 86.8%

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

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

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

      \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
    6. Taylor expanded in x around 0 46.7%

      \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
    7. Step-by-step derivation
      1. *-commutative46.7%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{a} \]
      2. associate-*l/49.9%

        \[\leadsto \color{blue}{\frac{y}{a} \cdot x} \]
      3. *-commutative49.9%

        \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
    8. Simplified49.9%

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

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

Alternative 8: 51.7% accurate, 1.8× speedup?

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

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

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

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

    \[\leadsto \color{blue}{\frac{x}{a} \cdot y} \]
  6. Taylor expanded in x around 0 51.7%

    \[\leadsto \color{blue}{\frac{x \cdot y}{a}} \]
  7. Step-by-step derivation
    1. *-commutative51.7%

      \[\leadsto \frac{\color{blue}{y \cdot x}}{a} \]
    2. associate-*l/55.2%

      \[\leadsto \color{blue}{\frac{y}{a} \cdot x} \]
    3. *-commutative55.2%

      \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
  8. Simplified55.2%

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

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

Developer target: 91.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
   (if (< z -2.468684968699548e+170)
     t_1
     (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = ((y / a) * x) - ((t / a) * z);
	double tmp;
	if (z < -2.468684968699548e+170) {
		tmp = t_1;
	} else if (z < 6.309831121978371e-71) {
		tmp = ((x * y) - (z * t)) / a;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = ((y / a) * x) - ((t / a) * z)
    if (z < (-2.468684968699548d+170)) then
        tmp = t_1
    else if (z < 6.309831121978371d-71) then
        tmp = ((x * y) - (z * t)) / a
    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 t_1 = ((y / a) * x) - ((t / a) * z);
	double tmp;
	if (z < -2.468684968699548e+170) {
		tmp = t_1;
	} else if (z < 6.309831121978371e-71) {
		tmp = ((x * y) - (z * t)) / a;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = ((y / a) * x) - ((t / a) * z)
	tmp = 0
	if z < -2.468684968699548e+170:
		tmp = t_1
	elif z < 6.309831121978371e-71:
		tmp = ((x * y) - (z * t)) / a
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z))
	tmp = 0.0
	if (z < -2.468684968699548e+170)
		tmp = t_1;
	elseif (z < 6.309831121978371e-71)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = ((y / a) * x) - ((t / a) * z);
	tmp = 0.0;
	if (z < -2.468684968699548e+170)
		tmp = t_1;
	elseif (z < 6.309831121978371e-71)
		tmp = ((x * y) - (z * t)) / a;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024041 
(FPCore (x y z t a)
  :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
  :precision binary64

  :herbie-target
  (if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))

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