Average Error: 7.9 → 1.4
Time: 6.7s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -9.286883594970578 \cdot 10^{231}:\\ \;\;\;\;y \cdot \frac{x}{a} - \frac{z}{\frac{a}{t}}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le -1.25866305328327661 \cdot 10^{-272}:\\ \;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le 3.5698267769368085 \cdot 10^{-11}:\\ \;\;\;\;\left(y \cdot \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{a}} - z \cdot \frac{t}{a}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le 1.17006433035619661 \cdot 10^{192}:\\ \;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a} - \frac{z}{\frac{a}{t}}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \le -9.286883594970578 \cdot 10^{231}:\\
\;\;\;\;y \cdot \frac{x}{a} - \frac{z}{\frac{a}{t}}\\

\mathbf{elif}\;x \cdot y - z \cdot t \le -1.25866305328327661 \cdot 10^{-272}:\\
\;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\

\mathbf{elif}\;x \cdot y - z \cdot t \le 3.5698267769368085 \cdot 10^{-11}:\\
\;\;\;\;\left(y \cdot \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{a}} - z \cdot \frac{t}{a}\\

\mathbf{elif}\;x \cdot y - z \cdot t \le 1.17006433035619661 \cdot 10^{192}:\\
\;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r883113 = x;
        double r883114 = y;
        double r883115 = r883113 * r883114;
        double r883116 = z;
        double r883117 = t;
        double r883118 = r883116 * r883117;
        double r883119 = r883115 - r883118;
        double r883120 = a;
        double r883121 = r883119 / r883120;
        return r883121;
}

double f(double x, double y, double z, double t, double a) {
        double r883122 = x;
        double r883123 = y;
        double r883124 = r883122 * r883123;
        double r883125 = z;
        double r883126 = t;
        double r883127 = r883125 * r883126;
        double r883128 = r883124 - r883127;
        double r883129 = -9.286883594970578e+231;
        bool r883130 = r883128 <= r883129;
        double r883131 = a;
        double r883132 = r883122 / r883131;
        double r883133 = r883123 * r883132;
        double r883134 = r883131 / r883126;
        double r883135 = r883125 / r883134;
        double r883136 = r883133 - r883135;
        double r883137 = -1.2586630532832766e-272;
        bool r883138 = r883128 <= r883137;
        double r883139 = 1.0;
        double r883140 = r883131 / r883128;
        double r883141 = r883139 / r883140;
        double r883142 = 3.5698267769368085e-11;
        bool r883143 = r883128 <= r883142;
        double r883144 = cbrt(r883122);
        double r883145 = r883144 * r883144;
        double r883146 = cbrt(r883131);
        double r883147 = r883146 * r883146;
        double r883148 = r883145 / r883147;
        double r883149 = r883123 * r883148;
        double r883150 = r883144 / r883146;
        double r883151 = r883149 * r883150;
        double r883152 = r883126 / r883131;
        double r883153 = r883125 * r883152;
        double r883154 = r883151 - r883153;
        double r883155 = 1.1700643303561966e+192;
        bool r883156 = r883128 <= r883155;
        double r883157 = r883156 ? r883141 : r883136;
        double r883158 = r883143 ? r883154 : r883157;
        double r883159 = r883138 ? r883141 : r883158;
        double r883160 = r883130 ? r883136 : r883159;
        return r883160;
}

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.9
Target6.0
Herbie1.4
\[\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 3 regimes
  2. if (- (* x y) (* z t)) < -9.286883594970578e+231 or 1.1700643303561966e+192 < (- (* x y) (* z t))

    1. Initial program 30.8

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

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

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

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

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

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

      \[\leadsto y \cdot \frac{x}{a} - \frac{\color{blue}{z \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}}{\sqrt[3]{a}}\]
    10. Using strategy rm
    11. Applied associate-/l*1.7

      \[\leadsto y \cdot \frac{x}{a} - \color{blue}{\frac{z}{\frac{\sqrt[3]{a}}{\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}}}\]
    12. Simplified1.1

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

    if -9.286883594970578e+231 < (- (* x y) (* z t)) < -1.2586630532832766e-272 or 3.5698267769368085e-11 < (- (* x y) (* z t)) < 1.1700643303561966e+192

    1. Initial program 0.3

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

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

    if -1.2586630532832766e-272 < (- (* x y) (* z t)) < 3.5698267769368085e-11

    1. Initial program 3.8

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

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

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

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

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

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

      \[\leadsto y \cdot \frac{x}{a} - \frac{\color{blue}{z \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}}{\sqrt[3]{a}}\]
    10. Using strategy rm
    11. Applied *-un-lft-identity6.4

      \[\leadsto y \cdot \frac{x}{a} - \frac{z \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}{\sqrt[3]{\color{blue}{1 \cdot a}}}\]
    12. Applied cbrt-prod6.4

      \[\leadsto y \cdot \frac{x}{a} - \frac{z \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}{\color{blue}{\sqrt[3]{1} \cdot \sqrt[3]{a}}}\]
    13. Applied times-frac7.5

      \[\leadsto y \cdot \frac{x}{a} - \color{blue}{\frac{z}{\sqrt[3]{1}} \cdot \frac{\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}{\sqrt[3]{a}}}\]
    14. Simplified7.5

      \[\leadsto y \cdot \frac{x}{a} - \color{blue}{z} \cdot \frac{\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}{\sqrt[3]{a}}\]
    15. Simplified7.1

      \[\leadsto y \cdot \frac{x}{a} - z \cdot \color{blue}{\frac{t}{a}}\]
    16. Using strategy rm
    17. Applied add-cube-cbrt7.5

      \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}} - z \cdot \frac{t}{a}\]
    18. Applied add-cube-cbrt7.6

      \[\leadsto y \cdot \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}} - z \cdot \frac{t}{a}\]
    19. Applied times-frac7.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -9.286883594970578 \cdot 10^{231}:\\ \;\;\;\;y \cdot \frac{x}{a} - \frac{z}{\frac{a}{t}}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le -1.25866305328327661 \cdot 10^{-272}:\\ \;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le 3.5698267769368085 \cdot 10^{-11}:\\ \;\;\;\;\left(y \cdot \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{a}} - z \cdot \frac{t}{a}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le 1.17006433035619661 \cdot 10^{192}:\\ \;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{a} - \frac{z}{\frac{a}{t}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(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))