Average Error: 6.3 → 1.3
Time: 8.9s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;a \le -9.089319465526926619489567709796493780074 \cdot 10^{-131}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;a \le 8.709696976931573596806654735929958388855 \cdot 10^{77}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \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 -9.089319465526926619489567709796493780074 \cdot 10^{-131}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r381539 = x;
        double r381540 = y;
        double r381541 = z;
        double r381542 = t;
        double r381543 = r381541 - r381542;
        double r381544 = r381540 * r381543;
        double r381545 = a;
        double r381546 = r381544 / r381545;
        double r381547 = r381539 + r381546;
        return r381547;
}

double f(double x, double y, double z, double t, double a) {
        double r381548 = a;
        double r381549 = -9.089319465526927e-131;
        bool r381550 = r381548 <= r381549;
        double r381551 = x;
        double r381552 = y;
        double r381553 = z;
        double r381554 = t;
        double r381555 = r381553 - r381554;
        double r381556 = r381548 / r381555;
        double r381557 = r381552 / r381556;
        double r381558 = r381551 + r381557;
        double r381559 = 8.709696976931574e+77;
        bool r381560 = r381548 <= r381559;
        double r381561 = r381552 * r381555;
        double r381562 = r381561 / r381548;
        double r381563 = r381551 + r381562;
        double r381564 = r381555 / r381548;
        double r381565 = r381552 * r381564;
        double r381566 = r381551 + r381565;
        double r381567 = r381560 ? r381563 : r381566;
        double r381568 = r381550 ? r381558 : r381567;
        return r381568;
}

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

Original6.3
Target0.7
Herbie1.3
\[\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 3 regimes
  2. if a < -9.089319465526927e-131

    1. Initial program 7.5

      \[x + \frac{y \cdot \left(z - t\right)}{a}\]
    2. Using strategy rm
    3. Applied associate-/l*1.8

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

    if -9.089319465526927e-131 < a < 8.709696976931574e+77

    1. Initial program 1.3

      \[x + \frac{y \cdot \left(z - t\right)}{a}\]

    if 8.709696976931574e+77 < a

    1. Initial program 12.0

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -9.089319465526926619489567709796493780074 \cdot 10^{-131}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;a \le 8.709696976931573596806654735929958388855 \cdot 10^{77}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \end{array}\]

Reproduce

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

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

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