Average Error: 7.8 → 0.8
Time: 3.5s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -3.78878154666729648028756748998228310304 \cdot 10^{207} \lor \neg \left(x \cdot y - z \cdot t \le -7.184454030855425458741927392588250354613 \cdot 10^{-77} \lor \neg \left(x \cdot y - z \cdot t \le 0.0 \lor \neg \left(x \cdot y - z \cdot t \le 6.902976578749531265225690058079584054697 \cdot 10^{274}\right)\right)\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot 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 - z \cdot t \le -3.78878154666729648028756748998228310304 \cdot 10^{207} \lor \neg \left(x \cdot y - z \cdot t \le -7.184454030855425458741927392588250354613 \cdot 10^{-77} \lor \neg \left(x \cdot y - z \cdot t \le 0.0 \lor \neg \left(x \cdot y - z \cdot t \le 6.902976578749531265225690058079584054697 \cdot 10^{274}\right)\right)\right):\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r794547 = x;
        double r794548 = y;
        double r794549 = r794547 * r794548;
        double r794550 = z;
        double r794551 = t;
        double r794552 = r794550 * r794551;
        double r794553 = r794549 - r794552;
        double r794554 = a;
        double r794555 = r794553 / r794554;
        return r794555;
}

double f(double x, double y, double z, double t, double a) {
        double r794556 = x;
        double r794557 = y;
        double r794558 = r794556 * r794557;
        double r794559 = z;
        double r794560 = t;
        double r794561 = r794559 * r794560;
        double r794562 = r794558 - r794561;
        double r794563 = -3.7887815466672965e+207;
        bool r794564 = r794562 <= r794563;
        double r794565 = -7.184454030855425e-77;
        bool r794566 = r794562 <= r794565;
        double r794567 = 0.0;
        bool r794568 = r794562 <= r794567;
        double r794569 = 6.902976578749531e+274;
        bool r794570 = r794562 <= r794569;
        double r794571 = !r794570;
        bool r794572 = r794568 || r794571;
        double r794573 = !r794572;
        bool r794574 = r794566 || r794573;
        double r794575 = !r794574;
        bool r794576 = r794564 || r794575;
        double r794577 = a;
        double r794578 = r794557 / r794577;
        double r794579 = r794556 * r794578;
        double r794580 = r794577 / r794559;
        double r794581 = r794560 / r794580;
        double r794582 = r794579 - r794581;
        double r794583 = r794558 / r794577;
        double r794584 = r794560 * r794559;
        double r794585 = r794584 / r794577;
        double r794586 = r794583 - r794585;
        double r794587 = r794576 ? r794582 : r794586;
        return r794587;
}

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.1
Herbie0.8
\[\begin{array}{l} \mathbf{if}\;z \lt -2.468684968699548224247694913169778644284 \cdot 10^{170}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{elif}\;z \lt 6.309831121978371209578784129518242708809 \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)) < -3.7887815466672965e+207 or -7.184454030855425e-77 < (- (* x y) (* z t)) < 0.0 or 6.902976578749531e+274 < (- (* x y) (* z t))

    1. Initial program 25.3

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

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

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t \cdot z}{a}}\]
    5. Using strategy rm
    6. Applied associate-/l*14.6

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

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

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

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

    if -3.7887815466672965e+207 < (- (* x y) (* z t)) < -7.184454030855425e-77 or 0.0 < (- (* x y) (* z t)) < 6.902976578749531e+274

    1. Initial program 0.5

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

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

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t \cdot z}{a}}\]
    5. Using strategy rm
    6. Applied associate-/l*5.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -3.78878154666729648028756748998228310304 \cdot 10^{207} \lor \neg \left(x \cdot y - z \cdot t \le -7.184454030855425458741927392588250354613 \cdot 10^{-77} \lor \neg \left(x \cdot y - z \cdot t \le 0.0 \lor \neg \left(x \cdot y - z \cdot t \le 6.902976578749531265225690058079584054697 \cdot 10^{274}\right)\right)\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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