Average Error: 5.9 → 1.0
Time: 19.9s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;a \le -3.924024237876823705783609140341883486631 \cdot 10^{-14}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;a \le 1.875486532986730162660285871460922359099 \cdot 10^{-85}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(z - t\right) \cdot y}} + x\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;a \le -3.924024237876823705783609140341883486631 \cdot 10^{-14}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\

\mathbf{elif}\;a \le 1.875486532986730162660285871460922359099 \cdot 10^{-85}:\\
\;\;\;\;\frac{1}{\frac{a}{\left(z - t\right) \cdot y}} + x\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r15835536 = x;
        double r15835537 = y;
        double r15835538 = z;
        double r15835539 = t;
        double r15835540 = r15835538 - r15835539;
        double r15835541 = r15835537 * r15835540;
        double r15835542 = a;
        double r15835543 = r15835541 / r15835542;
        double r15835544 = r15835536 + r15835543;
        return r15835544;
}

double f(double x, double y, double z, double t, double a) {
        double r15835545 = a;
        double r15835546 = -3.924024237876824e-14;
        bool r15835547 = r15835545 <= r15835546;
        double r15835548 = x;
        double r15835549 = y;
        double r15835550 = z;
        double r15835551 = t;
        double r15835552 = r15835550 - r15835551;
        double r15835553 = r15835552 / r15835545;
        double r15835554 = r15835549 * r15835553;
        double r15835555 = r15835548 + r15835554;
        double r15835556 = 1.8754865329867302e-85;
        bool r15835557 = r15835545 <= r15835556;
        double r15835558 = 1.0;
        double r15835559 = r15835552 * r15835549;
        double r15835560 = r15835545 / r15835559;
        double r15835561 = r15835558 / r15835560;
        double r15835562 = r15835561 + r15835548;
        double r15835563 = r15835557 ? r15835562 : r15835555;
        double r15835564 = r15835547 ? r15835555 : r15835563;
        return r15835564;
}

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

Original5.9
Target0.8
Herbie1.0
\[\begin{array}{l} \mathbf{if}\;y \lt -1.07612662163899753216593153715602325729 \cdot 10^{-10}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a}{z - t}}{y}}\\ \mathbf{elif}\;y \lt 2.894426862792089097262541964056085749132 \cdot 10^{-49}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if a < -3.924024237876824e-14 or 1.8754865329867302e-85 < a

    1. Initial program 8.1

      \[x + \frac{y \cdot \left(z - t\right)}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity8.1

      \[\leadsto x + \frac{y \cdot \left(z - t\right)}{\color{blue}{1 \cdot a}}\]
    4. Applied times-frac1.0

      \[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{z - t}{a}}\]
    5. Simplified1.0

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

    if -3.924024237876824e-14 < a < 1.8754865329867302e-85

    1. Initial program 0.9

      \[x + \frac{y \cdot \left(z - t\right)}{a}\]
    2. Using strategy rm
    3. Applied clear-num1.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -3.924024237876823705783609140341883486631 \cdot 10^{-14}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;a \le 1.875486532986730162660285871460922359099 \cdot 10^{-85}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(z - t\right) \cdot y}} + x\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019172 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"

  :herbie-target
  (if (< y -1.0761266216389975e-10) (+ x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))

  (+ x (/ (* y (- z t)) a)))