Average Error: 7.5 → 4.2
Time: 5.0s
Precision: binary64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq -7.07108368946119 \cdot 10^{-71} \lor \neg \left(z \cdot t \leq 5.093405697431204 \cdot 10^{-195}\right) \land z \cdot t \leq 8.389003426116215 \cdot 10^{+177}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right) \cdot \frac{\sqrt[3]{y}}{a} - \frac{z \cdot t}{a}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq -7.07108368946119 \cdot 10^{-71} \lor \neg \left(z \cdot t \leq 5.093405697431204 \cdot 10^{-195}\right) \land z \cdot t \leq 8.389003426116215 \cdot 10^{+177}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\

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

\end{array}
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= (* z t) (- INFINITY))
         (not
          (or (<= (* z t) -7.07108368946119e-71)
              (and (not (<= (* z t) 5.093405697431204e-195))
                   (<= (* z t) 8.389003426116215e+177)))))
   (- (* x (/ y a)) (* z (/ t a)))
   (- (* (* x (* (cbrt y) (cbrt y))) (/ (cbrt y) a)) (/ (* z t) a))))
double code(double x, double y, double z, double t, double a) {
	return ((x * y) - (z * t)) / a;
}
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (((z * t) <= -((double) INFINITY)) || !(((z * t) <= -7.07108368946119e-71) || (!((z * t) <= 5.093405697431204e-195) && ((z * t) <= 8.389003426116215e+177)))) {
		tmp = (x * (y / a)) - (z * (t / a));
	} else {
		tmp = ((x * (cbrt(y) * cbrt(y))) * (cbrt(y) / a)) - ((z * t) / a);
	}
	return tmp;
}

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.5
Target6.1
Herbie4.2
\[\begin{array}{l} \mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{elif}\;z < 6.309831121978371 \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 (*.f64 z t) < -inf.0 or -7.0710836894611897e-71 < (*.f64 z t) < 5.09340569743120393e-195 or 8.38900342611621471e177 < (*.f64 z t)

    1. Initial program 11.5

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

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

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

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{a}} - \frac{z \cdot t}{a}\]
    7. Simplified12.6

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

      \[\leadsto x \cdot \frac{y}{a} - \frac{z \cdot t}{\color{blue}{1 \cdot a}}\]
    10. Applied times-frac_binary645.3

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

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

    if -inf.0 < (*.f64 z t) < -7.0710836894611897e-71 or 5.09340569743120393e-195 < (*.f64 z t) < 8.38900342611621471e177

    1. Initial program 3.9

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

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

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

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

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

      \[\leadsto x \cdot \frac{y}{\color{blue}{1 \cdot a}} - \frac{z \cdot t}{a}\]
    10. Applied add-cube-cbrt_binary644.4

      \[\leadsto x \cdot \frac{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}{1 \cdot a} - \frac{z \cdot t}{a}\]
    11. Applied times-frac_binary644.4

      \[\leadsto x \cdot \color{blue}{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1} \cdot \frac{\sqrt[3]{y}}{a}\right)} - \frac{z \cdot t}{a}\]
    12. Applied associate-*r*_binary643.2

      \[\leadsto \color{blue}{\left(x \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1}\right) \cdot \frac{\sqrt[3]{y}}{a}} - \frac{z \cdot t}{a}\]
    13. Simplified3.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq -7.07108368946119 \cdot 10^{-71} \lor \neg \left(z \cdot t \leq 5.093405697431204 \cdot 10^{-195}\right) \land z \cdot t \leq 8.389003426116215 \cdot 10^{+177}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right) \cdot \frac{\sqrt[3]{y}}{a} - \frac{z \cdot t}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020219 
(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))