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

Percentage Accurate: 90.9% → 97.4%
Time: 12.0s
Alternatives: 11
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 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: 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.4% accurate, 0.1× speedup?

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

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

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

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


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

    1. Initial program 65.8%

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

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

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

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

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

    if -9.9999999999999996e297 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288

    1. Initial program 98.1%

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

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

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

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

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

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

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

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

    if 1e288 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 64.8%

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

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{a}} - \frac{z \cdot t}{a} \]
      4. fma-neg69.8%

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

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

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

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

Alternative 2: 97.1% accurate, 0.1× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a} - 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)) < -9.9999999999999996e297

    1. Initial program 65.8%

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

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

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

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

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

    if -9.9999999999999996e297 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288

    1. Initial program 98.1%

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

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

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

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

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

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

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

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

    if 1e288 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 64.8%

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

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

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

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

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

        \[\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*42.2%

        \[\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-rr42.2%

      \[\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-undefine42.2%

        \[\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-in42.2%

        \[\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-inv42.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\sqrt{a} \cdot \sqrt{a}}} \cdot y - t \cdot \frac{z}{a} \]
      4. add-sqr-sqrt92.0%

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

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

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

Alternative 3: 97.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot y - z \cdot t\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+298} \lor \neg \left(t\_1 \leq 10^{+288}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_1}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- (* x y) (* z t))))
   (if (or (<= t_1 -1e+298) (not (<= t_1 1e+288)))
     (- (* x (/ y a)) (* z (/ t a)))
     (/ t_1 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 <= -1e+298) || !(t_1 <= 1e+288)) {
		tmp = (x * (y / a)) - (z * (t / a));
	} else {
		tmp = t_1 / a;
	}
	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 = (x * y) - (z * t)
    if ((t_1 <= (-1d+298)) .or. (.not. (t_1 <= 1d+288))) then
        tmp = (x * (y / a)) - (z * (t / a))
    else
        tmp = t_1 / a
    end if
    code = tmp
end function
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 <= -1e+298) || !(t_1 <= 1e+288)) {
		tmp = (x * (y / a)) - (z * (t / a));
	} else {
		tmp = t_1 / a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (x * y) - (z * t)
	tmp = 0
	if (t_1 <= -1e+298) or not (t_1 <= 1e+288):
		tmp = (x * (y / a)) - (z * (t / a))
	else:
		tmp = t_1 / a
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x * y) - Float64(z * t))
	tmp = 0.0
	if ((t_1 <= -1e+298) || !(t_1 <= 1e+288))
		tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a)));
	else
		tmp = Float64(t_1 / a);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (x * y) - (z * t);
	tmp = 0.0;
	if ((t_1 <= -1e+298) || ~((t_1 <= 1e+288)))
		tmp = (x * (y / a)) - (z * (t / a));
	else
		tmp = t_1 / a;
	end
	tmp_2 = tmp;
end
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, -1e+298], N[Not[LessEqual[t$95$1, 1e+288]], $MachinePrecision]], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+298} \lor \neg \left(t\_1 \leq 10^{+288}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{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)) < -9.9999999999999996e297 or 1e288 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 65.3%

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

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

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

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

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

    if -9.9999999999999996e297 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288

    1. Initial program 98.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \leq -1 \cdot 10^{+298} \lor \neg \left(x \cdot y - z \cdot t \leq 10^{+288}\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 4: 97.1% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 10^{+288}:\\
\;\;\;\;\frac{t\_1}{a}\\

\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a} - 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)) < -9.9999999999999996e297

    1. Initial program 65.8%

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

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

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

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

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

    if -9.9999999999999996e297 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288

    1. Initial program 98.1%

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

    if 1e288 < (-.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 64.8%

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

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

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

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

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

        \[\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*42.2%

        \[\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-rr42.2%

      \[\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-undefine42.2%

        \[\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-in42.2%

        \[\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-inv42.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\sqrt{a} \cdot \sqrt{a}}} \cdot y - t \cdot \frac{z}{a} \]
      4. add-sqr-sqrt92.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \leq -1 \cdot 10^{+298}:\\ \;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\ \mathbf{elif}\;x \cdot y - z \cdot t \leq 10^{+288}:\\ \;\;\;\;\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 5: 94.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+282}:\\ \;\;\;\;\frac{z}{-\frac{a}{t}}\\ \mathbf{elif}\;z \cdot t \leq 10^{+305}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{a}{-z}}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= (* z t) -2e+282)
   (/ z (- (/ a t)))
   (if (<= (* z t) 1e+305) (/ (- (* x y) (* z t)) a) (/ t (/ a (- z))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z * t) <= -2e+282) {
		tmp = z / -(a / t);
	} else if ((z * t) <= 1e+305) {
		tmp = ((x * y) - (z * t)) / a;
	} else {
		tmp = t / (a / -z);
	}
	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) :: tmp
    if ((z * t) <= (-2d+282)) then
        tmp = z / -(a / t)
    else if ((z * t) <= 1d+305) then
        tmp = ((x * y) - (z * t)) / a
    else
        tmp = t / (a / -z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((z * t) <= -2e+282) {
		tmp = z / -(a / t);
	} else if ((z * t) <= 1e+305) {
		tmp = ((x * y) - (z * t)) / a;
	} else {
		tmp = t / (a / -z);
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (z * t) <= -2e+282:
		tmp = z / -(a / t)
	elif (z * t) <= 1e+305:
		tmp = ((x * y) - (z * t)) / a
	else:
		tmp = t / (a / -z)
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(z * t) <= -2e+282)
		tmp = Float64(z / Float64(-Float64(a / t)));
	elseif (Float64(z * t) <= 1e+305)
		tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a);
	else
		tmp = Float64(t / Float64(a / Float64(-z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((z * t) <= -2e+282)
		tmp = z / -(a / t);
	elseif ((z * t) <= 1e+305)
		tmp = ((x * y) - (z * t)) / a;
	else
		tmp = t / (a / -z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+282], N[(z / (-N[(a / t), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+305], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(t / N[(a / (-z)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+282}:\\
\;\;\;\;\frac{z}{-\frac{a}{t}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -2.00000000000000007e282

    1. Initial program 63.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}}} - \frac{z \cdot t}{a} \]
      5. fma-neg32.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*45.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-rr45.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-undefine45.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-in45.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-inv45.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - t \cdot \frac{z}{a}} \]
    7. Taylor expanded in y around 0 66.2%

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(-\frac{z}{a}\right)} \]
      4. distribute-neg-frac93.7%

        \[\leadsto t \cdot \color{blue}{\frac{-z}{a}} \]
    9. Simplified93.7%

      \[\leadsto \color{blue}{t \cdot \frac{-z}{a}} \]
    10. Step-by-step derivation
      1. distribute-frac-neg93.7%

        \[\leadsto t \cdot \color{blue}{\left(-\frac{z}{a}\right)} \]
      2. distribute-rgt-neg-in93.7%

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

        \[\leadsto -\color{blue}{\frac{z}{a} \cdot t} \]
      4. associate-/r/93.6%

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

        \[\leadsto \color{blue}{\frac{z}{-\frac{a}{t}}} \]
      6. distribute-neg-frac293.6%

        \[\leadsto \frac{z}{\color{blue}{\frac{a}{-t}}} \]
    11. Applied egg-rr93.6%

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

    if -2.00000000000000007e282 < (*.f64 z t) < 9.9999999999999994e304

    1. Initial program 95.2%

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

    if 9.9999999999999994e304 < (*.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-sub53.4%

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

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

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

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

        \[\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*28.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-rr28.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-undefine28.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-in28.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-inv28.5%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - t \cdot \frac{z}{a}} \]
    7. Taylor expanded in y around 0 53.4%

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\frac{-z}{a}} \]
    9. Simplified99.4%

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

        \[\leadsto t \cdot \color{blue}{\left(-\frac{z}{a}\right)} \]
      2. distribute-rgt-neg-in99.4%

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

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

        \[\leadsto \left(-t\right) \cdot \color{blue}{\frac{1}{\frac{a}{z}}} \]
      5. un-div-inv99.8%

        \[\leadsto \color{blue}{\frac{-t}{\frac{a}{z}}} \]
    11. Applied egg-rr99.8%

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

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

Alternative 6: 71.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-11}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-108}:\\ \;\;\;\;t \cdot \frac{z}{-a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= (* x y) -1e-11)
   (* y (/ x a))
   (if (<= (* x y) 5e-108) (* t (/ z (- a))) (/ (* x y) a))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((x * y) <= -1e-11) {
		tmp = y * (x / a);
	} else if ((x * y) <= 5e-108) {
		tmp = t * (z / -a);
	} else {
		tmp = (x * y) / a;
	}
	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) :: tmp
    if ((x * y) <= (-1d-11)) then
        tmp = y * (x / a)
    else if ((x * y) <= 5d-108) then
        tmp = t * (z / -a)
    else
        tmp = (x * y) / a
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((x * y) <= -1e-11) {
		tmp = y * (x / a);
	} else if ((x * y) <= 5e-108) {
		tmp = t * (z / -a);
	} else {
		tmp = (x * y) / a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (x * y) <= -1e-11:
		tmp = y * (x / a)
	elif (x * y) <= 5e-108:
		tmp = t * (z / -a)
	else:
		tmp = (x * y) / a
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(x * y) <= -1e-11)
		tmp = Float64(y * Float64(x / a));
	elseif (Float64(x * y) <= 5e-108)
		tmp = Float64(t * Float64(z / Float64(-a)));
	else
		tmp = Float64(Float64(x * y) / a);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((x * y) <= -1e-11)
		tmp = y * (x / a);
	elseif ((x * y) <= 5e-108)
		tmp = t * (z / -a);
	else
		tmp = (x * y) / a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e-11], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-108], N[(t * N[(z / (-a)), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-11}:\\
\;\;\;\;y \cdot \frac{x}{a}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -9.99999999999999939e-12

    1. Initial program 86.6%

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

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

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

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

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

    if -9.99999999999999939e-12 < (*.f64 x y) < 5e-108

    1. Initial program 90.3%

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

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

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

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

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

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

    if 5e-108 < (*.f64 x y)

    1. Initial program 89.7%

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

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

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

Alternative 7: 71.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-11}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-108}:\\ \;\;\;\;\frac{t}{\frac{a}{-z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= (* x y) -1e-11)
   (* y (/ x a))
   (if (<= (* x y) 5e-108) (/ t (/ a (- z))) (/ (* x y) a))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((x * y) <= -1e-11) {
		tmp = y * (x / a);
	} else if ((x * y) <= 5e-108) {
		tmp = t / (a / -z);
	} else {
		tmp = (x * y) / a;
	}
	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) :: tmp
    if ((x * y) <= (-1d-11)) then
        tmp = y * (x / a)
    else if ((x * y) <= 5d-108) then
        tmp = t / (a / -z)
    else
        tmp = (x * y) / a
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((x * y) <= -1e-11) {
		tmp = y * (x / a);
	} else if ((x * y) <= 5e-108) {
		tmp = t / (a / -z);
	} else {
		tmp = (x * y) / a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (x * y) <= -1e-11:
		tmp = y * (x / a)
	elif (x * y) <= 5e-108:
		tmp = t / (a / -z)
	else:
		tmp = (x * y) / a
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (Float64(x * y) <= -1e-11)
		tmp = Float64(y * Float64(x / a));
	elseif (Float64(x * y) <= 5e-108)
		tmp = Float64(t / Float64(a / Float64(-z)));
	else
		tmp = Float64(Float64(x * y) / a);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((x * y) <= -1e-11)
		tmp = y * (x / a);
	elseif ((x * y) <= 5e-108)
		tmp = t / (a / -z);
	else
		tmp = (x * y) / a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e-11], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-108], N[(t / N[(a / (-z)), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-11}:\\
\;\;\;\;y \cdot \frac{x}{a}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -9.99999999999999939e-12

    1. Initial program 86.6%

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

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

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

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

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

    if -9.99999999999999939e-12 < (*.f64 x y) < 5e-108

    1. Initial program 90.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sqrt{a}} \cdot \frac{x \cdot y}{\sqrt{a}}} - \frac{z \cdot t}{a} \]
      5. fma-neg47.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*43.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-rr43.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-undefine43.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-in43.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-inv43.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\sqrt{a}}}{\sqrt{a}} - t \cdot \frac{z}{a}} \]
    7. Taylor expanded in y around 0 80.8%

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

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

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

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

        \[\leadsto t \cdot \color{blue}{\frac{-z}{a}} \]
    9. Simplified86.4%

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

        \[\leadsto t \cdot \color{blue}{\left(-\frac{z}{a}\right)} \]
      2. distribute-rgt-neg-in86.4%

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

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

        \[\leadsto \left(-t\right) \cdot \color{blue}{\frac{1}{\frac{a}{z}}} \]
      5. un-div-inv86.6%

        \[\leadsto \color{blue}{\frac{-t}{\frac{a}{z}}} \]
    11. Applied egg-rr86.6%

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

    if 5e-108 < (*.f64 x y)

    1. Initial program 89.7%

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

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

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

Alternative 8: 51.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{-115}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= x -3.8e-115) (* y (/ x a)) (* x (/ y a))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -3.8e-115) {
		tmp = y * (x / a);
	} else {
		tmp = x * (y / a);
	}
	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) :: tmp
    if (x <= (-3.8d-115)) then
        tmp = y * (x / a)
    else
        tmp = x * (y / a)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -3.8e-115) {
		tmp = y * (x / a);
	} else {
		tmp = x * (y / a);
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if x <= -3.8e-115:
		tmp = y * (x / a)
	else:
		tmp = x * (y / a)
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (x <= -3.8e-115)
		tmp = Float64(y * Float64(x / a));
	else
		tmp = Float64(x * Float64(y / a));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (x <= -3.8e-115)
		tmp = y * (x / a);
	else
		tmp = x * (y / a);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -3.8e-115], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-115}:\\
\;\;\;\;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 < -3.79999999999999992e-115

    1. Initial program 88.2%

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

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

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

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

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

    if -3.79999999999999992e-115 < x

    1. Initial program 89.4%

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

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

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

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

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

Alternative 9: 51.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.75 \cdot 10^{-245}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= x -1.75e-245) (* y (/ x a)) (/ x (/ a y))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -1.75e-245) {
		tmp = y * (x / a);
	} else {
		tmp = x / (a / y);
	}
	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) :: tmp
    if (x <= (-1.75d-245)) then
        tmp = y * (x / a)
    else
        tmp = x / (a / y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -1.75e-245) {
		tmp = y * (x / a);
	} else {
		tmp = x / (a / y);
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if x <= -1.75e-245:
		tmp = y * (x / a)
	else:
		tmp = x / (a / y)
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (x <= -1.75e-245)
		tmp = Float64(y * Float64(x / a));
	else
		tmp = Float64(x / Float64(a / y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (x <= -1.75e-245)
		tmp = y * (x / a);
	else
		tmp = x / (a / y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.75e-245], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-245}:\\
\;\;\;\;y \cdot \frac{x}{a}\\

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


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

    1. Initial program 88.3%

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

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

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

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

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

    if -1.75000000000000008e-245 < x

    1. Initial program 89.6%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{a}} \]
    6. Step-by-step derivation
      1. clear-num48.8%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{a}{y}}} \]
      2. un-div-inv48.6%

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

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

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

Alternative 10: 50.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{-127}:\\ \;\;\;\;y \cdot \frac{x}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= x -1.35e-127) (* y (/ x a)) (/ (* x y) a)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -1.35e-127) {
		tmp = y * (x / a);
	} else {
		tmp = (x * y) / a;
	}
	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) :: tmp
    if (x <= (-1.35d-127)) then
        tmp = y * (x / a)
    else
        tmp = (x * y) / a
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (x <= -1.35e-127) {
		tmp = y * (x / a);
	} else {
		tmp = (x * y) / a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if x <= -1.35e-127:
		tmp = y * (x / a)
	else:
		tmp = (x * y) / a
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (x <= -1.35e-127)
		tmp = Float64(y * Float64(x / a));
	else
		tmp = Float64(Float64(x * y) / a);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (x <= -1.35e-127)
		tmp = y * (x / a);
	else
		tmp = (x * y) / a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.35e-127], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-127}:\\
\;\;\;\;y \cdot \frac{x}{a}\\

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


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

    1. Initial program 88.9%

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

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

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

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

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

    if -1.35e-127 < x

    1. Initial program 89.1%

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

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

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

Alternative 11: 51.0% accurate, 1.8× speedup?

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

\\
x \cdot \frac{y}{a}
\end{array}
Derivation
  1. Initial program 89.0%

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

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

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

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

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

Developer target: 90.7% 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 2024043 
(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))