Average Error: 7.5 → 6.1
Time: 14.4s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot t \le 7.55743289222484695 \cdot 10^{206}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\frac{y \cdot x}{a} - \frac{t}{a} \cdot z}}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;z \cdot t \le 7.55743289222484695 \cdot 10^{206}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r808546 = x;
        double r808547 = y;
        double r808548 = r808546 * r808547;
        double r808549 = z;
        double r808550 = t;
        double r808551 = r808549 * r808550;
        double r808552 = r808548 - r808551;
        double r808553 = a;
        double r808554 = r808552 / r808553;
        return r808554;
}

double f(double x, double y, double z, double t, double a) {
        double r808555 = z;
        double r808556 = t;
        double r808557 = r808555 * r808556;
        double r808558 = 7.557432892224847e+206;
        bool r808559 = r808557 <= r808558;
        double r808560 = x;
        double r808561 = y;
        double r808562 = r808560 * r808561;
        double r808563 = r808562 - r808557;
        double r808564 = a;
        double r808565 = r808563 / r808564;
        double r808566 = 1.0;
        double r808567 = r808561 * r808560;
        double r808568 = r808567 / r808564;
        double r808569 = r808556 / r808564;
        double r808570 = r808569 * r808555;
        double r808571 = r808568 - r808570;
        double r808572 = r808566 / r808571;
        double r808573 = r808566 / r808572;
        double r808574 = r808559 ? r808565 : r808573;
        return r808574;
}

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
Target5.8
Herbie6.1
\[\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 (* z t) < 7.557432892224847e+206

    1. Initial program 6.0

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

    if 7.557432892224847e+206 < (* z t)

    1. Initial program 30.3

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{x \cdot y - z \cdot t}}}\]
    4. Using strategy rm
    5. Applied clear-num30.3

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

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{\frac{x \cdot y - t \cdot z}{a}}}}\]
    7. Using strategy rm
    8. Applied div-sub30.3

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \le 7.55743289222484695 \cdot 10^{206}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\frac{y \cdot x}{a} - \frac{t}{a} \cdot z}}\\ \end{array}\]

Reproduce

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