Average Error: 7.7 → 2.2
Time: 4.4s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -1.42769642305035037 \cdot 10^{138} \lor \neg \left(x \cdot y - z \cdot t \le 5.05725067830339464 \cdot 10^{219}\right):\\ \;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{t \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)}{\frac{a}{\sqrt[3]{z}}}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \le -1.42769642305035037 \cdot 10^{138} \lor \neg \left(x \cdot y - z \cdot t \le 5.05725067830339464 \cdot 10^{219}\right):\\
\;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a} - \frac{t \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)}{\frac{a}{\sqrt[3]{z}}}\\

\end{array}
double code(double x, double y, double z, double t, double a) {
	return ((double) (((double) (((double) (x * y)) - ((double) (z * t)))) / a));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if (((((double) (((double) (x * y)) - ((double) (z * t)))) <= -1.4276964230503504e+138) || !(((double) (((double) (x * y)) - ((double) (z * t)))) <= 5.0572506783033946e+219))) {
		VAR = ((double) (((double) (y * ((double) (x / a)))) - ((double) (t * ((double) (z / a))))));
	} else {
		VAR = ((double) (((double) (((double) (x * y)) / a)) - ((double) (((double) (t * ((double) (((double) cbrt(z)) * ((double) cbrt(z)))))) / ((double) (a / ((double) cbrt(z))))))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.7
Target6.3
Herbie2.2
\[\begin{array}{l} \mathbf{if}\;z \lt -2.46868496869954822 \cdot 10^{170}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{elif}\;z \lt 6.30983112197837121 \cdot 10^{-71}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (- (* x y) (* z t)) < -1.4276964230503504e+138 or 5.0572506783033946e+219 < (- (* x y) (* z t))

    1. Initial program 24.7

      \[\frac{x \cdot y - z \cdot t}{a}\]
    2. Using strategy rm
    3. Applied div-sub24.7

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

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t \cdot z}{a}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity24.7

      \[\leadsto \frac{x \cdot y}{a} - \frac{t \cdot z}{\color{blue}{1 \cdot a}}\]
    7. Applied times-frac14.0

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t}{1} \cdot \frac{z}{a}}\]
    8. Simplified14.0

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{t} \cdot \frac{z}{a}\]
    9. Using strategy rm
    10. Applied *-un-lft-identity14.0

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot a}} - t \cdot \frac{z}{a}\]
    11. Applied *-commutative14.0

      \[\leadsto \frac{\color{blue}{y \cdot x}}{1 \cdot a} - t \cdot \frac{z}{a}\]
    12. Applied times-frac2.2

      \[\leadsto \color{blue}{\frac{y}{1} \cdot \frac{x}{a}} - t \cdot \frac{z}{a}\]
    13. Simplified2.2

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

    if -1.4276964230503504e+138 < (- (* x y) (* z t)) < 5.0572506783033946e+219

    1. Initial program 0.8

      \[\frac{x \cdot y - z \cdot t}{a}\]
    2. Using strategy rm
    3. Applied div-sub0.8

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

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t \cdot z}{a}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity0.8

      \[\leadsto \frac{x \cdot y}{a} - \frac{t \cdot z}{\color{blue}{1 \cdot a}}\]
    7. Applied times-frac5.9

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t}{1} \cdot \frac{z}{a}}\]
    8. Simplified5.9

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{t} \cdot \frac{z}{a}\]
    9. Using strategy rm
    10. Applied add-cube-cbrt6.3

      \[\leadsto \frac{x \cdot y}{a} - t \cdot \frac{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}{a}\]
    11. Applied associate-/l*6.3

      \[\leadsto \frac{x \cdot y}{a} - t \cdot \color{blue}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\frac{a}{\sqrt[3]{z}}}}\]
    12. Applied associate-*r/2.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -1.42769642305035037 \cdot 10^{138} \lor \neg \left(x \cdot y - z \cdot t \le 5.05725067830339464 \cdot 10^{219}\right):\\ \;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{t \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)}{\frac{a}{\sqrt[3]{z}}}\\ \end{array}\]

Reproduce

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

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

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