Average Error: 7.8 → 5.0
Time: 8.0s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.84154847940333438 \cdot 10^{268}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le 5.0132949514285239 \cdot 10^{-62}:\\ \;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\ \mathbf{elif}\;x \cdot y \le 2.10280870876133442 \cdot 10^{131}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t \cdot z}{a}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -1.84154847940333438 \cdot 10^{268}:\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t \cdot z}{a}\\

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

\mathbf{elif}\;x \cdot y \le 2.10280870876133442 \cdot 10^{131}:\\
\;\;\;\;\frac{x \cdot y}{a} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r4791 = x;
        double r4792 = y;
        double r4793 = r4791 * r4792;
        double r4794 = z;
        double r4795 = t;
        double r4796 = r4794 * r4795;
        double r4797 = r4793 - r4796;
        double r4798 = a;
        double r4799 = r4797 / r4798;
        return r4799;
}

double f(double x, double y, double z, double t, double a) {
        double r4800 = x;
        double r4801 = y;
        double r4802 = r4800 * r4801;
        double r4803 = -1.8415484794033344e+268;
        bool r4804 = r4802 <= r4803;
        double r4805 = a;
        double r4806 = r4801 / r4805;
        double r4807 = r4800 * r4806;
        double r4808 = t;
        double r4809 = z;
        double r4810 = r4808 * r4809;
        double r4811 = r4810 / r4805;
        double r4812 = r4807 - r4811;
        double r4813 = 5.013294951428524e-62;
        bool r4814 = r4802 <= r4813;
        double r4815 = 1.0;
        double r4816 = r4809 * r4808;
        double r4817 = r4802 - r4816;
        double r4818 = r4805 / r4817;
        double r4819 = r4815 / r4818;
        double r4820 = 2.1028087087613344e+131;
        bool r4821 = r4802 <= r4820;
        double r4822 = r4802 / r4805;
        double r4823 = cbrt(r4805);
        double r4824 = r4823 * r4823;
        double r4825 = r4808 / r4824;
        double r4826 = r4809 / r4823;
        double r4827 = r4825 * r4826;
        double r4828 = r4822 - r4827;
        double r4829 = r4821 ? r4828 : r4812;
        double r4830 = r4814 ? r4819 : r4829;
        double r4831 = r4804 ? r4812 : r4830;
        return r4831;
}

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.8
Target6.3
Herbie5.0
\[\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) < -1.8415484794033344e+268 or 2.1028087087613344e+131 < (* x y)

    1. Initial program 28.0

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

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

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

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

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

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

    if -1.8415484794033344e+268 < (* x y) < 5.013294951428524e-62

    1. Initial program 4.6

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

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

    if 5.013294951428524e-62 < (* x y) < 2.1028087087613344e+131

    1. Initial program 3.1

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.84154847940333438 \cdot 10^{268}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le 5.0132949514285239 \cdot 10^{-62}:\\ \;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\ \mathbf{elif}\;x \cdot y \le 2.10280870876133442 \cdot 10^{131}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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