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

Percentage Accurate: 91.6% → 96.3%
Time: 13.4s
Alternatives: 11
Speedup: 0.3×

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 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 91.6% 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: 96.3% accurate, 0.0× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ \begin{array}{l} t_1 := t \cdot \frac{z}{a\_m}\\ t_2 := x \cdot y - z \cdot t\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;\frac{y \cdot \frac{x}{\sqrt{a\_m}}}{\sqrt{a\_m}} - t\_1\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+261}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \frac{1}{\sqrt{a\_m}}\right) \cdot \frac{y}{\sqrt{a\_m}} - t\_1\\ \end{array} \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 1 a)
(FPCore (a_s x y z t a_m)
 :precision binary64
 (let* ((t_1 (* t (/ z a_m))) (t_2 (- (* x y) (* z t))))
   (*
    a_s
    (if (<= t_2 (- INFINITY))
      (- (/ (* y (/ x (sqrt a_m))) (sqrt a_m)) t_1)
      (if (<= t_2 5e+261)
        (/ (fma x y (* z (- t))) a_m)
        (- (* (* x (/ 1.0 (sqrt a_m))) (/ y (sqrt a_m))) t_1))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double t_1 = t * (z / a_m);
	double t_2 = (x * y) - (z * t);
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = ((y * (x / sqrt(a_m))) / sqrt(a_m)) - t_1;
	} else if (t_2 <= 5e+261) {
		tmp = fma(x, y, (z * -t)) / a_m;
	} else {
		tmp = ((x * (1.0 / sqrt(a_m))) * (y / sqrt(a_m))) - t_1;
	}
	return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0, a)
function code(a_s, x, y, z, t, a_m)
	t_1 = Float64(t * Float64(z / a_m))
	t_2 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = Float64(Float64(Float64(y * Float64(x / sqrt(a_m))) / sqrt(a_m)) - t_1);
	elseif (t_2 <= 5e+261)
		tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a_m);
	else
		tmp = Float64(Float64(Float64(x * Float64(1.0 / sqrt(a_m))) * Float64(y / sqrt(a_m))) - t_1);
	end
	return Float64(a_s * tmp)
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := Block[{t$95$1 = N[(t * N[(z / a$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(y * N[(x / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 5e+261], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(N[(x * N[(1.0 / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)

\\
\begin{array}{l}
t_1 := t \cdot \frac{z}{a\_m}\\
t_2 := x \cdot y - z \cdot t\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\frac{y \cdot \frac{x}{\sqrt{a\_m}}}{\sqrt{a\_m}} - t\_1\\

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

\mathbf{else}:\\
\;\;\;\;\left(x \cdot \frac{1}{\sqrt{a\_m}}\right) \cdot \frac{y}{\sqrt{a\_m}} - t\_1\\


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

    1. Initial program 60.0%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-un-lft-identity60.0%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt23.5%

        \[\leadsto \frac{1 \cdot \left(x \cdot y\right)}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} - \frac{z \cdot t}{a} \]
      4. times-frac23.5%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}}} - \frac{z \cdot t}{a} \]
      5. fma-neg23.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -\frac{z \cdot t}{a}\right)} \]
      6. associate-/l*35.1%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -\color{blue}{z \cdot \frac{t}{a}}\right) \]
    4. Applied egg-rr35.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
    5. Step-by-step derivation
      1. fma-undefine35.1%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} + \left(-z \cdot \frac{t}{a}\right)} \]
      2. distribute-lft-neg-in35.1%

        \[\leadsto \frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} + \color{blue}{\left(-z\right) \cdot \frac{t}{a}} \]
      3. cancel-sign-sub-inv35.1%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} - z \cdot \frac{t}{a}} \]
      4. associate-*l/35.1%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x \cdot y}{\sqrt{a}}}{\sqrt{a}}} - z \cdot \frac{t}{a} \]
      5. *-lft-identity35.1%

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{\sqrt{a}}}}{\sqrt{a}} - z \cdot \frac{t}{a} \]
      6. *-commutative35.1%

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

        \[\leadsto \frac{\color{blue}{y \cdot \frac{x}{\sqrt{a}}}}{\sqrt{a}} - z \cdot \frac{t}{a} \]
      8. associate-*r/31.8%

        \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - \color{blue}{\frac{z \cdot t}{a}} \]
      9. *-commutative31.8%

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

        \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - \color{blue}{t \cdot \frac{z}{a}} \]
    6. Simplified43.3%

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000001e261

    1. Initial program 98.7%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-commutative97.1%

        \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{t \cdot z}}{a} \]
      3. div-sub98.7%

        \[\leadsto \color{blue}{\frac{x \cdot y - t \cdot z}{a}} \]
      4. *-commutative98.7%

        \[\leadsto \frac{x \cdot y - \color{blue}{z \cdot t}}{a} \]
      5. fma-neg98.7%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, y, -z \cdot t\right)}}{a} \]
      6. distribute-rgt-neg-out98.7%

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

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

    if 5.0000000000000001e261 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 71.5%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-un-lft-identity71.5%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt32.9%

        \[\leadsto \frac{1 \cdot \left(x \cdot y\right)}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} - \frac{z \cdot t}{a} \]
      4. times-frac32.9%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}}} - \frac{z \cdot t}{a} \]
      5. fma-neg32.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -\frac{z \cdot t}{a}\right)} \]
      6. associate-/l*37.5%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
    5. Step-by-step derivation
      1. fma-undefine37.5%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} + \left(-z \cdot \frac{t}{a}\right)} \]
      2. distribute-lft-neg-in37.5%

        \[\leadsto \frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} + \color{blue}{\left(-z\right) \cdot \frac{t}{a}} \]
      3. cancel-sign-sub-inv37.5%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} - z \cdot \frac{t}{a}} \]
      4. associate-/l*39.9%

        \[\leadsto \frac{1}{\sqrt{a}} \cdot \color{blue}{\left(x \cdot \frac{y}{\sqrt{a}}\right)} - z \cdot \frac{t}{a} \]
      5. associate-*r*39.9%

        \[\leadsto \color{blue}{\left(\frac{1}{\sqrt{a}} \cdot x\right) \cdot \frac{y}{\sqrt{a}}} - z \cdot \frac{t}{a} \]
      6. associate-*r/35.3%

        \[\leadsto \left(\frac{1}{\sqrt{a}} \cdot x\right) \cdot \frac{y}{\sqrt{a}} - \color{blue}{\frac{z \cdot t}{a}} \]
      7. *-commutative35.3%

        \[\leadsto \left(\frac{1}{\sqrt{a}} \cdot x\right) \cdot \frac{y}{\sqrt{a}} - \frac{\color{blue}{t \cdot z}}{a} \]
      8. associate-/l*40.0%

        \[\leadsto \left(\frac{1}{\sqrt{a}} \cdot x\right) \cdot \frac{y}{\sqrt{a}} - \color{blue}{t \cdot \frac{z}{a}} \]
    6. Simplified40.0%

      \[\leadsto \color{blue}{\left(\frac{1}{\sqrt{a}} \cdot x\right) \cdot \frac{y}{\sqrt{a}} - t \cdot \frac{z}{a}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \leq -\infty:\\ \;\;\;\;\frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - t \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - z \cdot t \leq 5 \cdot 10^{+261}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \frac{1}{\sqrt{a}}\right) \cdot \frac{y}{\sqrt{a}} - t \cdot \frac{z}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 95.7% accurate, 0.0× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ \begin{array}{l} t_1 := x \cdot y - z \cdot t\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\frac{y \cdot \frac{x}{\sqrt{a\_m}}}{\sqrt{a\_m}} - t \cdot \frac{z}{a\_m}\\ \mathbf{elif}\;t\_1 \leq 10^{+168}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a\_m} - \frac{t}{\frac{a\_m}{z}}\\ \end{array} \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 1 a)
(FPCore (a_s x y z t a_m)
 :precision binary64
 (let* ((t_1 (- (* x y) (* z t))))
   (*
    a_s
    (if (<= t_1 (- INFINITY))
      (- (/ (* y (/ x (sqrt a_m))) (sqrt a_m)) (* t (/ z a_m)))
      (if (<= t_1 1e+168)
        (/ (fma x y (* z (- t))) a_m)
        (- (* x (/ y a_m)) (/ t (/ a_m z))))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double t_1 = (x * y) - (z * t);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = ((y * (x / sqrt(a_m))) / sqrt(a_m)) - (t * (z / a_m));
	} else if (t_1 <= 1e+168) {
		tmp = fma(x, y, (z * -t)) / a_m;
	} else {
		tmp = (x * (y / a_m)) - (t / (a_m / z));
	}
	return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0, a)
function code(a_s, x, y, z, t, a_m)
	t_1 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(Float64(Float64(y * Float64(x / sqrt(a_m))) / sqrt(a_m)) - Float64(t * Float64(z / a_m)));
	elseif (t_1 <= 1e+168)
		tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a_m);
	else
		tmp = Float64(Float64(x * Float64(y / a_m)) - Float64(t / Float64(a_m / z)));
	end
	return Float64(a_s * tmp)
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(y * N[(x / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+168], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)

\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{y \cdot \frac{x}{\sqrt{a\_m}}}{\sqrt{a\_m}} - t \cdot \frac{z}{a\_m}\\

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

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


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

    1. Initial program 60.0%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-un-lft-identity60.0%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt23.5%

        \[\leadsto \frac{1 \cdot \left(x \cdot y\right)}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} - \frac{z \cdot t}{a} \]
      4. times-frac23.5%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}}} - \frac{z \cdot t}{a} \]
      5. fma-neg23.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -\frac{z \cdot t}{a}\right)} \]
      6. associate-/l*35.1%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -\color{blue}{z \cdot \frac{t}{a}}\right) \]
    4. Applied egg-rr35.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
    5. Step-by-step derivation
      1. fma-undefine35.1%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} + \left(-z \cdot \frac{t}{a}\right)} \]
      2. distribute-lft-neg-in35.1%

        \[\leadsto \frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} + \color{blue}{\left(-z\right) \cdot \frac{t}{a}} \]
      3. cancel-sign-sub-inv35.1%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} - z \cdot \frac{t}{a}} \]
      4. associate-*l/35.1%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x \cdot y}{\sqrt{a}}}{\sqrt{a}}} - z \cdot \frac{t}{a} \]
      5. *-lft-identity35.1%

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{\sqrt{a}}}}{\sqrt{a}} - z \cdot \frac{t}{a} \]
      6. *-commutative35.1%

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

        \[\leadsto \frac{\color{blue}{y \cdot \frac{x}{\sqrt{a}}}}{\sqrt{a}} - z \cdot \frac{t}{a} \]
      8. associate-*r/31.8%

        \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - \color{blue}{\frac{z \cdot t}{a}} \]
      9. *-commutative31.8%

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

        \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - \color{blue}{t \cdot \frac{z}{a}} \]
    6. Simplified43.3%

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 9.9999999999999993e167

    1. Initial program 98.6%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Step-by-step derivation
      1. div-sub96.8%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-commutative96.8%

        \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{t \cdot z}}{a} \]
      3. div-sub98.6%

        \[\leadsto \color{blue}{\frac{x \cdot y - t \cdot z}{a}} \]
      4. *-commutative98.6%

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, y, -z \cdot t\right)}}{a} \]
      6. distribute-rgt-neg-out98.6%

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

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

    if 9.9999999999999993e167 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 81.2%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-un-lft-identity81.2%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt37.9%

        \[\leadsto \frac{1 \cdot \left(x \cdot y\right)}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} - \frac{z \cdot t}{a} \]
      4. times-frac37.8%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}}} - \frac{z \cdot t}{a} \]
      5. fma-neg37.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -\frac{z \cdot t}{a}\right)} \]
      6. associate-/l*40.8%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -\color{blue}{z \cdot \frac{t}{a}}\right) \]
    4. Applied egg-rr40.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
    5. Step-by-step derivation
      1. fma-undefine40.8%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} + \left(-z \cdot \frac{t}{a}\right)} \]
      2. distribute-lft-neg-in40.8%

        \[\leadsto \frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} + \color{blue}{\left(-z\right) \cdot \frac{t}{a}} \]
      3. cancel-sign-sub-inv40.8%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} - z \cdot \frac{t}{a}} \]
      4. associate-*l/40.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x \cdot y}{\sqrt{a}}}{\sqrt{a}}} - z \cdot \frac{t}{a} \]
      5. *-lft-identity40.8%

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{\sqrt{a}}}}{\sqrt{a}} - z \cdot \frac{t}{a} \]
      6. *-commutative40.8%

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

        \[\leadsto \frac{\color{blue}{y \cdot \frac{x}{\sqrt{a}}}}{\sqrt{a}} - z \cdot \frac{t}{a} \]
      8. associate-*r/39.4%

        \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - \color{blue}{\frac{z \cdot t}{a}} \]
      9. *-commutative39.4%

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

        \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - \color{blue}{t \cdot \frac{z}{a}} \]
    6. Simplified42.4%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - t \cdot \frac{z}{a}} \]
    7. Step-by-step derivation
      1. clear-num42.4%

        \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - t \cdot \color{blue}{\frac{1}{\frac{a}{z}}} \]
      2. un-div-inv42.4%

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

      \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - \color{blue}{\frac{t}{\frac{a}{z}}} \]
    9. Step-by-step derivation
      1. associate-/l*42.5%

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

        \[\leadsto y \cdot \color{blue}{\frac{x}{\sqrt{a} \cdot \sqrt{a}}} - \frac{t}{\frac{a}{z}} \]
      3. add-sqr-sqrt96.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \leq -\infty:\\ \;\;\;\;\frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - t \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y - z \cdot t \leq 10^{+168}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 96.3% accurate, 0.1× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ \begin{array}{l} t_1 := x \cdot \frac{y}{a\_m}\\ t_2 := x \cdot y - z \cdot t\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;t\_1 - z \cdot \frac{t}{a\_m}\\ \mathbf{elif}\;t\_2 \leq 10^{+168}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;t\_1 - \frac{t}{\frac{a\_m}{z}}\\ \end{array} \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 1 a)
(FPCore (a_s x y z t a_m)
 :precision binary64
 (let* ((t_1 (* x (/ y a_m))) (t_2 (- (* x y) (* z t))))
   (*
    a_s
    (if (<= t_2 (- INFINITY))
      (- t_1 (* z (/ t a_m)))
      (if (<= t_2 1e+168)
        (/ (fma x y (* z (- t))) a_m)
        (- t_1 (/ t (/ a_m z))))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double t_1 = x * (y / a_m);
	double t_2 = (x * y) - (z * t);
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = t_1 - (z * (t / a_m));
	} else if (t_2 <= 1e+168) {
		tmp = fma(x, y, (z * -t)) / a_m;
	} else {
		tmp = t_1 - (t / (a_m / z));
	}
	return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0, a)
function code(a_s, x, y, z, t, a_m)
	t_1 = Float64(x * Float64(y / a_m))
	t_2 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = Float64(t_1 - Float64(z * Float64(t / a_m)));
	elseif (t_2 <= 1e+168)
		tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a_m);
	else
		tmp = Float64(t_1 - Float64(t / Float64(a_m / z)));
	end
	return Float64(a_s * tmp)
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := Block[{t$95$1 = N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$2, (-Infinity)], N[(t$95$1 - N[(z * N[(t / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+168], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(t$95$1 - N[(t / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)

\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{a\_m}\\
t_2 := x \cdot y - z \cdot t\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1 - z \cdot \frac{t}{a\_m}\\

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

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


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

    1. Initial program 60.0%

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

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

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

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

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 9.9999999999999993e167

    1. Initial program 98.6%

      \[\frac{x \cdot y - z \cdot t}{a} \]
    2. Step-by-step derivation
      1. div-sub96.8%

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-commutative96.8%

        \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{t \cdot z}}{a} \]
      3. div-sub98.6%

        \[\leadsto \color{blue}{\frac{x \cdot y - t \cdot z}{a}} \]
      4. *-commutative98.6%

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, y, -z \cdot t\right)}}{a} \]
      6. distribute-rgt-neg-out98.6%

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

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

    if 9.9999999999999993e167 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 81.2%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-un-lft-identity81.2%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt37.9%

        \[\leadsto \frac{1 \cdot \left(x \cdot y\right)}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} - \frac{z \cdot t}{a} \]
      4. times-frac37.8%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}}} - \frac{z \cdot t}{a} \]
      5. fma-neg37.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -\frac{z \cdot t}{a}\right)} \]
      6. associate-/l*40.8%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -\color{blue}{z \cdot \frac{t}{a}}\right) \]
    4. Applied egg-rr40.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
    5. Step-by-step derivation
      1. fma-undefine40.8%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} + \left(-z \cdot \frac{t}{a}\right)} \]
      2. distribute-lft-neg-in40.8%

        \[\leadsto \frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} + \color{blue}{\left(-z\right) \cdot \frac{t}{a}} \]
      3. cancel-sign-sub-inv40.8%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} - z \cdot \frac{t}{a}} \]
      4. associate-*l/40.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x \cdot y}{\sqrt{a}}}{\sqrt{a}}} - z \cdot \frac{t}{a} \]
      5. *-lft-identity40.8%

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{\sqrt{a}}}}{\sqrt{a}} - z \cdot \frac{t}{a} \]
      6. *-commutative40.8%

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

        \[\leadsto \frac{\color{blue}{y \cdot \frac{x}{\sqrt{a}}}}{\sqrt{a}} - z \cdot \frac{t}{a} \]
      8. associate-*r/39.4%

        \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - \color{blue}{\frac{z \cdot t}{a}} \]
      9. *-commutative39.4%

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

        \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - \color{blue}{t \cdot \frac{z}{a}} \]
    6. Simplified42.4%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - t \cdot \frac{z}{a}} \]
    7. Step-by-step derivation
      1. clear-num42.4%

        \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - t \cdot \color{blue}{\frac{1}{\frac{a}{z}}} \]
      2. un-div-inv42.4%

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

      \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - \color{blue}{\frac{t}{\frac{a}{z}}} \]
    9. Step-by-step derivation
      1. associate-/l*42.5%

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

        \[\leadsto y \cdot \color{blue}{\frac{x}{\sqrt{a} \cdot \sqrt{a}}} - \frac{t}{\frac{a}{z}} \]
      3. add-sqr-sqrt96.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \leq -\infty:\\ \;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\ \mathbf{elif}\;x \cdot y - z \cdot t \leq 10^{+168}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 97.1% accurate, 0.3× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ \begin{array}{l} t_1 := x \cdot y - z \cdot t\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 10^{+303}\right):\\ \;\;\;\;x \cdot \frac{y}{a\_m} - z \cdot \frac{t}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_1}{a\_m}\\ \end{array} \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 1 a)
(FPCore (a_s x y z t a_m)
 :precision binary64
 (let* ((t_1 (- (* x y) (* z t))))
   (*
    a_s
    (if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+303)))
      (- (* x (/ y a_m)) (* z (/ t a_m)))
      (/ t_1 a_m)))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double t_1 = (x * y) - (z * t);
	double tmp;
	if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 1e+303)) {
		tmp = (x * (y / a_m)) - (z * (t / a_m));
	} else {
		tmp = t_1 / a_m;
	}
	return a_s * tmp;
}
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double t_1 = (x * y) - (z * t);
	double tmp;
	if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 1e+303)) {
		tmp = (x * (y / a_m)) - (z * (t / a_m));
	} else {
		tmp = t_1 / a_m;
	}
	return a_s * tmp;
}
a\_m = math.fabs(a)
a\_s = math.copysign(1.0, a)
def code(a_s, x, y, z, t, a_m):
	t_1 = (x * y) - (z * t)
	tmp = 0
	if (t_1 <= -math.inf) or not (t_1 <= 1e+303):
		tmp = (x * (y / a_m)) - (z * (t / a_m))
	else:
		tmp = t_1 / a_m
	return a_s * tmp
a\_m = abs(a)
a\_s = copysign(1.0, a)
function code(a_s, x, y, z, t, a_m)
	t_1 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if ((t_1 <= Float64(-Inf)) || !(t_1 <= 1e+303))
		tmp = Float64(Float64(x * Float64(y / a_m)) - Float64(z * Float64(t / a_m)));
	else
		tmp = Float64(t_1 / a_m);
	end
	return Float64(a_s * tmp)
end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
function tmp_2 = code(a_s, x, y, z, t, a_m)
	t_1 = (x * y) - (z * t);
	tmp = 0.0;
	if ((t_1 <= -Inf) || ~((t_1 <= 1e+303)))
		tmp = (x * (y / a_m)) - (z * (t / a_m));
	else
		tmp = t_1 / a_m;
	end
	tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+303]], $MachinePrecision]], N[(N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a$95$m), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)

\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 10^{+303}\right):\\
\;\;\;\;x \cdot \frac{y}{a\_m} - z \cdot \frac{t}{a\_m}\\

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


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

    1. Initial program 63.3%

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

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

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

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

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e303

    1. Initial program 98.7%

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

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

Alternative 5: 96.3% accurate, 0.3× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ \begin{array}{l} t_1 := x \cdot \frac{y}{a\_m}\\ t_2 := x \cdot y - z \cdot t\\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;t\_1 - z \cdot \frac{t}{a\_m}\\ \mathbf{elif}\;t\_2 \leq 10^{+168}:\\ \;\;\;\;\frac{t\_2}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;t\_1 - \frac{t}{\frac{a\_m}{z}}\\ \end{array} \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 1 a)
(FPCore (a_s x y z t a_m)
 :precision binary64
 (let* ((t_1 (* x (/ y a_m))) (t_2 (- (* x y) (* z t))))
   (*
    a_s
    (if (<= t_2 (- INFINITY))
      (- t_1 (* z (/ t a_m)))
      (if (<= t_2 1e+168) (/ t_2 a_m) (- t_1 (/ t (/ a_m z))))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double t_1 = x * (y / a_m);
	double t_2 = (x * y) - (z * t);
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = t_1 - (z * (t / a_m));
	} else if (t_2 <= 1e+168) {
		tmp = t_2 / a_m;
	} else {
		tmp = t_1 - (t / (a_m / z));
	}
	return a_s * tmp;
}
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double t_1 = x * (y / a_m);
	double t_2 = (x * y) - (z * t);
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = t_1 - (z * (t / a_m));
	} else if (t_2 <= 1e+168) {
		tmp = t_2 / a_m;
	} else {
		tmp = t_1 - (t / (a_m / z));
	}
	return a_s * tmp;
}
a\_m = math.fabs(a)
a\_s = math.copysign(1.0, a)
def code(a_s, x, y, z, t, a_m):
	t_1 = x * (y / a_m)
	t_2 = (x * y) - (z * t)
	tmp = 0
	if t_2 <= -math.inf:
		tmp = t_1 - (z * (t / a_m))
	elif t_2 <= 1e+168:
		tmp = t_2 / a_m
	else:
		tmp = t_1 - (t / (a_m / z))
	return a_s * tmp
a\_m = abs(a)
a\_s = copysign(1.0, a)
function code(a_s, x, y, z, t, a_m)
	t_1 = Float64(x * Float64(y / a_m))
	t_2 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = Float64(t_1 - Float64(z * Float64(t / a_m)));
	elseif (t_2 <= 1e+168)
		tmp = Float64(t_2 / a_m);
	else
		tmp = Float64(t_1 - Float64(t / Float64(a_m / z)));
	end
	return Float64(a_s * tmp)
end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
function tmp_2 = code(a_s, x, y, z, t, a_m)
	t_1 = x * (y / a_m);
	t_2 = (x * y) - (z * t);
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = t_1 - (z * (t / a_m));
	elseif (t_2 <= 1e+168)
		tmp = t_2 / a_m;
	else
		tmp = t_1 - (t / (a_m / z));
	end
	tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := Block[{t$95$1 = N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$2, (-Infinity)], N[(t$95$1 - N[(z * N[(t / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+168], N[(t$95$2 / a$95$m), $MachinePrecision], N[(t$95$1 - N[(t / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)

\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{a\_m}\\
t_2 := x \cdot y - z \cdot t\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1 - z \cdot \frac{t}{a\_m}\\

\mathbf{elif}\;t\_2 \leq 10^{+168}:\\
\;\;\;\;\frac{t\_2}{a\_m}\\

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


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

    1. Initial program 60.0%

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

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

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

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

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 9.9999999999999993e167

    1. Initial program 98.6%

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

    if 9.9999999999999993e167 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 81.2%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}} \]
      2. *-un-lft-identity81.2%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y\right)}}{a} - \frac{z \cdot t}{a} \]
      3. add-sqr-sqrt37.9%

        \[\leadsto \frac{1 \cdot \left(x \cdot y\right)}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} - \frac{z \cdot t}{a} \]
      4. times-frac37.8%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}}} - \frac{z \cdot t}{a} \]
      5. fma-neg37.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -\frac{z \cdot t}{a}\right)} \]
      6. associate-/l*40.8%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -\color{blue}{z \cdot \frac{t}{a}}\right) \]
    4. Applied egg-rr40.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{x \cdot y}{\sqrt{a}}, -z \cdot \frac{t}{a}\right)} \]
    5. Step-by-step derivation
      1. fma-undefine40.8%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} + \left(-z \cdot \frac{t}{a}\right)} \]
      2. distribute-lft-neg-in40.8%

        \[\leadsto \frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} + \color{blue}{\left(-z\right) \cdot \frac{t}{a}} \]
      3. cancel-sign-sub-inv40.8%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}} - z \cdot \frac{t}{a}} \]
      4. associate-*l/40.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x \cdot y}{\sqrt{a}}}{\sqrt{a}}} - z \cdot \frac{t}{a} \]
      5. *-lft-identity40.8%

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{\sqrt{a}}}}{\sqrt{a}} - z \cdot \frac{t}{a} \]
      6. *-commutative40.8%

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

        \[\leadsto \frac{\color{blue}{y \cdot \frac{x}{\sqrt{a}}}}{\sqrt{a}} - z \cdot \frac{t}{a} \]
      8. associate-*r/39.4%

        \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - \color{blue}{\frac{z \cdot t}{a}} \]
      9. *-commutative39.4%

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

        \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - \color{blue}{t \cdot \frac{z}{a}} \]
    6. Simplified42.4%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - t \cdot \frac{z}{a}} \]
    7. Step-by-step derivation
      1. clear-num42.4%

        \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - t \cdot \color{blue}{\frac{1}{\frac{a}{z}}} \]
      2. un-div-inv42.4%

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

      \[\leadsto \frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - \color{blue}{\frac{t}{\frac{a}{z}}} \]
    9. Step-by-step derivation
      1. associate-/l*42.5%

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

        \[\leadsto y \cdot \color{blue}{\frac{x}{\sqrt{a} \cdot \sqrt{a}}} - \frac{t}{\frac{a}{z}} \]
      3. add-sqr-sqrt96.6%

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

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

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

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

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

Alternative 6: 63.8% accurate, 0.6× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq -2.7 \cdot 10^{-85} \lor \neg \left(t \leq 2 \cdot 10^{+170}\right):\\ \;\;\;\;t \cdot \frac{z}{-a\_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 1 a)
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (or (<= t -2.7e-85) (not (<= t 2e+170)))
    (* t (/ z (- a_m)))
    (* y (/ x a_m)))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((t <= -2.7e-85) || !(t <= 2e+170)) {
		tmp = t * (z / -a_m);
	} else {
		tmp = y * (x / a_m);
	}
	return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    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_m
    real(8) :: tmp
    if ((t <= (-2.7d-85)) .or. (.not. (t <= 2d+170))) then
        tmp = t * (z / -a_m)
    else
        tmp = y * (x / a_m)
    end if
    code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if ((t <= -2.7e-85) || !(t <= 2e+170)) {
		tmp = t * (z / -a_m);
	} else {
		tmp = y * (x / a_m);
	}
	return a_s * tmp;
}
a\_m = math.fabs(a)
a\_s = math.copysign(1.0, a)
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if (t <= -2.7e-85) or not (t <= 2e+170):
		tmp = t * (z / -a_m)
	else:
		tmp = y * (x / a_m)
	return a_s * tmp
a\_m = abs(a)
a\_s = copysign(1.0, a)
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if ((t <= -2.7e-85) || !(t <= 2e+170))
		tmp = Float64(t * Float64(z / Float64(-a_m)));
	else
		tmp = Float64(y * Float64(x / a_m));
	end
	return Float64(a_s * tmp)
end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if ((t <= -2.7e-85) || ~((t <= 2e+170)))
		tmp = t * (z / -a_m);
	else
		tmp = y * (x / a_m);
	end
	tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[Or[LessEqual[t, -2.7e-85], N[Not[LessEqual[t, 2e+170]], $MachinePrecision]], N[(t * N[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)

\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -2.7 \cdot 10^{-85} \lor \neg \left(t \leq 2 \cdot 10^{+170}\right):\\
\;\;\;\;t \cdot \frac{z}{-a\_m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.7000000000000001e-85 or 2.00000000000000007e170 < t

    1. Initial program 88.6%

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

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

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

        \[\leadsto -\color{blue}{t \cdot \frac{z}{a}} \]
      3. distribute-rgt-neg-in68.3%

        \[\leadsto \color{blue}{t \cdot \left(-\frac{z}{a}\right)} \]
    5. Simplified68.3%

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

    if -2.7000000000000001e-85 < t < 2.00000000000000007e170

    1. Initial program 92.7%

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

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

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

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

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

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

Alternative 7: 63.9% accurate, 0.6× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq -2.45 \cdot 10^{-85}:\\ \;\;\;\;z \cdot \frac{t}{-a\_m}\\ \mathbf{elif}\;t \leq 7.2 \cdot 10^{+171}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{z}{-a\_m}\\ \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 1 a)
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= t -2.45e-85)
    (* z (/ t (- a_m)))
    (if (<= t 7.2e+171) (* y (/ x a_m)) (* t (/ z (- a_m)))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (t <= -2.45e-85) {
		tmp = z * (t / -a_m);
	} else if (t <= 7.2e+171) {
		tmp = y * (x / a_m);
	} else {
		tmp = t * (z / -a_m);
	}
	return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    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_m
    real(8) :: tmp
    if (t <= (-2.45d-85)) then
        tmp = z * (t / -a_m)
    else if (t <= 7.2d+171) then
        tmp = y * (x / a_m)
    else
        tmp = t * (z / -a_m)
    end if
    code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (t <= -2.45e-85) {
		tmp = z * (t / -a_m);
	} else if (t <= 7.2e+171) {
		tmp = y * (x / a_m);
	} else {
		tmp = t * (z / -a_m);
	}
	return a_s * tmp;
}
a\_m = math.fabs(a)
a\_s = math.copysign(1.0, a)
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if t <= -2.45e-85:
		tmp = z * (t / -a_m)
	elif t <= 7.2e+171:
		tmp = y * (x / a_m)
	else:
		tmp = t * (z / -a_m)
	return a_s * tmp
a\_m = abs(a)
a\_s = copysign(1.0, a)
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (t <= -2.45e-85)
		tmp = Float64(z * Float64(t / Float64(-a_m)));
	elseif (t <= 7.2e+171)
		tmp = Float64(y * Float64(x / a_m));
	else
		tmp = Float64(t * Float64(z / Float64(-a_m)));
	end
	return Float64(a_s * tmp)
end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if (t <= -2.45e-85)
		tmp = z * (t / -a_m);
	elseif (t <= 7.2e+171)
		tmp = y * (x / a_m);
	else
		tmp = t * (z / -a_m);
	end
	tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[t, -2.45e-85], N[(z * N[(t / (-a$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.2e+171], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], N[(t * N[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)

\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -2.45 \cdot 10^{-85}:\\
\;\;\;\;z \cdot \frac{t}{-a\_m}\\

\mathbf{elif}\;t \leq 7.2 \cdot 10^{+171}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.45000000000000007e-85

    1. Initial program 87.4%

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\left(z \cdot \frac{t}{a}\right)} \]
      3. neg-mul-166.0%

        \[\leadsto \color{blue}{-z \cdot \frac{t}{a}} \]
      4. distribute-lft-neg-in66.0%

        \[\leadsto \color{blue}{\left(-z\right) \cdot \frac{t}{a}} \]
    5. Simplified66.0%

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

    if -2.45000000000000007e-85 < t < 7.20000000000000036e171

    1. Initial program 92.7%

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

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

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

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

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

    if 7.20000000000000036e171 < t

    1. Initial program 92.4%

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

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

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

        \[\leadsto -\color{blue}{t \cdot \frac{z}{a}} \]
      3. distribute-rgt-neg-in81.7%

        \[\leadsto \color{blue}{t \cdot \left(-\frac{z}{a}\right)} \]
    5. Simplified81.7%

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

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

Alternative 8: 64.1% accurate, 0.6× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq -2.2 \cdot 10^{-80}:\\ \;\;\;\;z \cdot \frac{t}{-a\_m}\\ \mathbf{elif}\;t \leq 2 \cdot 10^{+170}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{a\_m}{-z}}\\ \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 1 a)
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= t -2.2e-80)
    (* z (/ t (- a_m)))
    (if (<= t 2e+170) (* y (/ x a_m)) (/ t (/ a_m (- z)))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (t <= -2.2e-80) {
		tmp = z * (t / -a_m);
	} else if (t <= 2e+170) {
		tmp = y * (x / a_m);
	} else {
		tmp = t / (a_m / -z);
	}
	return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    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_m
    real(8) :: tmp
    if (t <= (-2.2d-80)) then
        tmp = z * (t / -a_m)
    else if (t <= 2d+170) then
        tmp = y * (x / a_m)
    else
        tmp = t / (a_m / -z)
    end if
    code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (t <= -2.2e-80) {
		tmp = z * (t / -a_m);
	} else if (t <= 2e+170) {
		tmp = y * (x / a_m);
	} else {
		tmp = t / (a_m / -z);
	}
	return a_s * tmp;
}
a\_m = math.fabs(a)
a\_s = math.copysign(1.0, a)
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if t <= -2.2e-80:
		tmp = z * (t / -a_m)
	elif t <= 2e+170:
		tmp = y * (x / a_m)
	else:
		tmp = t / (a_m / -z)
	return a_s * tmp
a\_m = abs(a)
a\_s = copysign(1.0, a)
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (t <= -2.2e-80)
		tmp = Float64(z * Float64(t / Float64(-a_m)));
	elseif (t <= 2e+170)
		tmp = Float64(y * Float64(x / a_m));
	else
		tmp = Float64(t / Float64(a_m / Float64(-z)));
	end
	return Float64(a_s * tmp)
end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if (t <= -2.2e-80)
		tmp = z * (t / -a_m);
	elseif (t <= 2e+170)
		tmp = y * (x / a_m);
	else
		tmp = t / (a_m / -z);
	end
	tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[t, -2.2e-80], N[(z * N[(t / (-a$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2e+170], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], N[(t / N[(a$95$m / (-z)), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)

\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{-80}:\\
\;\;\;\;z \cdot \frac{t}{-a\_m}\\

\mathbf{elif}\;t \leq 2 \cdot 10^{+170}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.2000000000000001e-80

    1. Initial program 87.4%

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\left(z \cdot \frac{t}{a}\right)} \]
      3. neg-mul-166.0%

        \[\leadsto \color{blue}{-z \cdot \frac{t}{a}} \]
      4. distribute-lft-neg-in66.0%

        \[\leadsto \color{blue}{\left(-z\right) \cdot \frac{t}{a}} \]
    5. Simplified66.0%

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

    if -2.2000000000000001e-80 < t < 2.00000000000000007e170

    1. Initial program 92.7%

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

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

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

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

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

    if 2.00000000000000007e170 < t

    1. Initial program 92.4%

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

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(t \cdot z\right)}}{a} \]
    4. Step-by-step derivation
      1. mul-1-neg85.3%

        \[\leadsto \frac{\color{blue}{-t \cdot z}}{a} \]
      2. *-commutative85.3%

        \[\leadsto \frac{-\color{blue}{z \cdot t}}{a} \]
      3. distribute-rgt-neg-in85.3%

        \[\leadsto \frac{\color{blue}{z \cdot \left(-t\right)}}{a} \]
    5. Simplified85.3%

      \[\leadsto \frac{\color{blue}{z \cdot \left(-t\right)}}{a} \]
    6. Step-by-step derivation
      1. *-commutative85.3%

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

        \[\leadsto \color{blue}{\left(-t\right) \cdot \frac{z}{a}} \]
      3. add-sqr-sqrt0.0%

        \[\leadsto \color{blue}{\left(\sqrt{-t} \cdot \sqrt{-t}\right)} \cdot \frac{z}{a} \]
      4. sqrt-unprod7.5%

        \[\leadsto \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}} \cdot \frac{z}{a} \]
      5. sqr-neg7.5%

        \[\leadsto \sqrt{\color{blue}{t \cdot t}} \cdot \frac{z}{a} \]
      6. sqrt-unprod1.1%

        \[\leadsto \color{blue}{\left(\sqrt{t} \cdot \sqrt{t}\right)} \cdot \frac{z}{a} \]
      7. add-sqr-sqrt1.1%

        \[\leadsto \color{blue}{t} \cdot \frac{z}{a} \]
      8. clear-num1.1%

        \[\leadsto t \cdot \color{blue}{\frac{1}{\frac{a}{z}}} \]
      9. div-inv1.1%

        \[\leadsto \color{blue}{\frac{t}{\frac{a}{z}}} \]
      10. frac-2neg1.1%

        \[\leadsto \color{blue}{\frac{-t}{-\frac{a}{z}}} \]
      11. div-inv1.1%

        \[\leadsto \color{blue}{\left(-t\right) \cdot \frac{1}{-\frac{a}{z}}} \]
      12. add-sqr-sqrt0.0%

        \[\leadsto \color{blue}{\left(\sqrt{-t} \cdot \sqrt{-t}\right)} \cdot \frac{1}{-\frac{a}{z}} \]
      13. sqrt-unprod32.9%

        \[\leadsto \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}} \cdot \frac{1}{-\frac{a}{z}} \]
      14. sqr-neg32.9%

        \[\leadsto \sqrt{\color{blue}{t \cdot t}} \cdot \frac{1}{-\frac{a}{z}} \]
      15. sqrt-unprod81.5%

        \[\leadsto \color{blue}{\left(\sqrt{t} \cdot \sqrt{t}\right)} \cdot \frac{1}{-\frac{a}{z}} \]
      16. add-sqr-sqrt81.7%

        \[\leadsto \color{blue}{t} \cdot \frac{1}{-\frac{a}{z}} \]
      17. distribute-neg-frac281.7%

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

      \[\leadsto \color{blue}{t \cdot \frac{1}{\frac{a}{-z}}} \]
    8. Step-by-step derivation
      1. associate-*r/81.8%

        \[\leadsto \color{blue}{\frac{t \cdot 1}{\frac{a}{-z}}} \]
      2. *-rgt-identity81.8%

        \[\leadsto \frac{\color{blue}{t}}{\frac{a}{-z}} \]
    9. Simplified81.8%

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

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

Alternative 9: 91.1% accurate, 0.6× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{+242}:\\ \;\;\;\;z \cdot \frac{t}{-a\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\ \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 1 a)
(FPCore (a_s x y z t a_m)
 :precision binary64
 (*
  a_s
  (if (<= z -1.25e+242) (* z (/ t (- a_m))) (/ (- (* x y) (* z t)) a_m))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (z <= -1.25e+242) {
		tmp = z * (t / -a_m);
	} else {
		tmp = ((x * y) - (z * t)) / a_m;
	}
	return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    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_m
    real(8) :: tmp
    if (z <= (-1.25d+242)) then
        tmp = z * (t / -a_m)
    else
        tmp = ((x * y) - (z * t)) / a_m
    end if
    code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (z <= -1.25e+242) {
		tmp = z * (t / -a_m);
	} else {
		tmp = ((x * y) - (z * t)) / a_m;
	}
	return a_s * tmp;
}
a\_m = math.fabs(a)
a\_s = math.copysign(1.0, a)
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if z <= -1.25e+242:
		tmp = z * (t / -a_m)
	else:
		tmp = ((x * y) - (z * t)) / a_m
	return a_s * tmp
a\_m = abs(a)
a\_s = copysign(1.0, a)
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (z <= -1.25e+242)
		tmp = Float64(z * Float64(t / Float64(-a_m)));
	else
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m);
	end
	return Float64(a_s * tmp)
end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if (z <= -1.25e+242)
		tmp = z * (t / -a_m);
	else
		tmp = ((x * y) - (z * t)) / a_m;
	end
	tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[z, -1.25e+242], N[(z * N[(t / (-a$95$m)), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)

\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+242}:\\
\;\;\;\;z \cdot \frac{t}{-a\_m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.2500000000000001e242

    1. Initial program 61.9%

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\left(z \cdot \frac{t}{a}\right)} \]
      3. neg-mul-196.4%

        \[\leadsto \color{blue}{-z \cdot \frac{t}{a}} \]
      4. distribute-lft-neg-in96.4%

        \[\leadsto \color{blue}{\left(-z\right) \cdot \frac{t}{a}} \]
    5. Simplified96.4%

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

    if -1.2500000000000001e242 < z

    1. Initial program 92.1%

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

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

Alternative 10: 51.9% accurate, 0.9× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ a\_s \cdot \begin{array}{l} \mathbf{if}\;x \leq -4.7 \cdot 10^{-208}:\\ \;\;\;\;y \cdot \frac{x}{a\_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a\_m}\\ \end{array} \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 1 a)
(FPCore (a_s x y z t a_m)
 :precision binary64
 (* a_s (if (<= x -4.7e-208) (* y (/ x a_m)) (* x (/ y a_m)))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (x <= -4.7e-208) {
		tmp = y * (x / a_m);
	} else {
		tmp = x * (y / a_m);
	}
	return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    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_m
    real(8) :: tmp
    if (x <= (-4.7d-208)) then
        tmp = y * (x / a_m)
    else
        tmp = x * (y / a_m)
    end if
    code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	double tmp;
	if (x <= -4.7e-208) {
		tmp = y * (x / a_m);
	} else {
		tmp = x * (y / a_m);
	}
	return a_s * tmp;
}
a\_m = math.fabs(a)
a\_s = math.copysign(1.0, a)
def code(a_s, x, y, z, t, a_m):
	tmp = 0
	if x <= -4.7e-208:
		tmp = y * (x / a_m)
	else:
		tmp = x * (y / a_m)
	return a_s * tmp
a\_m = abs(a)
a\_s = copysign(1.0, a)
function code(a_s, x, y, z, t, a_m)
	tmp = 0.0
	if (x <= -4.7e-208)
		tmp = Float64(y * Float64(x / a_m));
	else
		tmp = Float64(x * Float64(y / a_m));
	end
	return Float64(a_s * tmp)
end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
function tmp_2 = code(a_s, x, y, z, t, a_m)
	tmp = 0.0;
	if (x <= -4.7e-208)
		tmp = y * (x / a_m);
	else
		tmp = x * (y / a_m);
	end
	tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[x, -4.7e-208], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)

\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -4.7 \cdot 10^{-208}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\

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


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

    1. Initial program 89.4%

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

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

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

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

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

    if -4.7000000000000003e-208 < x

    1. Initial program 92.1%

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

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

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

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

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

Alternative 11: 51.6% accurate, 1.8× speedup?

\[\begin{array}{l} a\_m = \left|a\right| \\ a\_s = \mathsf{copysign}\left(1, a\right) \\ a\_s \cdot \left(x \cdot \frac{y}{a\_m}\right) \end{array} \]
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 1 a)
(FPCore (a_s x y z t a_m) :precision binary64 (* a_s (* x (/ y a_m))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double x, double y, double z, double t, double a_m) {
	return a_s * (x * (y / a_m));
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, x, y, z, t, a_m)
    real(8), intent (in) :: a_s
    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_m
    code = a_s * (x * (y / a_m))
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
	return a_s * (x * (y / a_m));
}
a\_m = math.fabs(a)
a\_s = math.copysign(1.0, a)
def code(a_s, x, y, z, t, a_m):
	return a_s * (x * (y / a_m))
a\_m = abs(a)
a\_s = copysign(1.0, a)
function code(a_s, x, y, z, t, a_m)
	return Float64(a_s * Float64(x * Float64(y / a_m)))
end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
function tmp = code(a_s, x, y, z, t, a_m)
	tmp = a_s * (x * (y / a_m));
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)

\\
a\_s \cdot \left(x \cdot \frac{y}{a\_m}\right)
\end{array}
Derivation
  1. Initial program 90.9%

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

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

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

    \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
  6. Final simplification53.4%

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

Developer target: 91.4% 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 2024053 
(FPCore (x y z t a)
  :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
  :precision binary64

  :alt
  (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))