Average Error: 6.0 → 2.8
Time: 16.8s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \le -8.849888808122146521489747851127158756761 \cdot 10^{-111} \lor \neg \left(x \le -2.114727761639354300733285470511003056337 \cdot 10^{-292}\right):\\ \;\;\;\;x + \frac{y}{a} \cdot \left(z - t\right)\\ \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}\;x \le -8.849888808122146521489747851127158756761 \cdot 10^{-111} \lor \neg \left(x \le -2.114727761639354300733285470511003056337 \cdot 10^{-292}\right):\\
\;\;\;\;x + \frac{y}{a} \cdot \left(z - t\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r341537 = x;
        double r341538 = y;
        double r341539 = z;
        double r341540 = t;
        double r341541 = r341539 - r341540;
        double r341542 = r341538 * r341541;
        double r341543 = a;
        double r341544 = r341542 / r341543;
        double r341545 = r341537 + r341544;
        return r341545;
}

double f(double x, double y, double z, double t, double a) {
        double r341546 = x;
        double r341547 = -8.849888808122147e-111;
        bool r341548 = r341546 <= r341547;
        double r341549 = -2.1147277616393543e-292;
        bool r341550 = r341546 <= r341549;
        double r341551 = !r341550;
        bool r341552 = r341548 || r341551;
        double r341553 = y;
        double r341554 = a;
        double r341555 = r341553 / r341554;
        double r341556 = z;
        double r341557 = t;
        double r341558 = r341556 - r341557;
        double r341559 = r341555 * r341558;
        double r341560 = r341546 + r341559;
        double r341561 = r341558 / r341554;
        double r341562 = r341553 * r341561;
        double r341563 = r341546 + r341562;
        double r341564 = r341552 ? r341560 : r341563;
        return r341564;
}

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.0
Target0.8
Herbie2.8
\[\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 x < -8.849888808122147e-111 or -2.1147277616393543e-292 < x

    1. Initial program 6.1

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

      \[\leadsto x + \color{blue}{\frac{y}{\frac{a}{z - t}}}\]
    4. Using strategy rm
    5. Applied associate-/r/2.2

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

    if -8.849888808122147e-111 < x < -2.1147277616393543e-292

    1. Initial program 5.2

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -8.849888808122146521489747851127158756761 \cdot 10^{-111} \lor \neg \left(x \le -2.114727761639354300733285470511003056337 \cdot 10^{-292}\right):\\ \;\;\;\;x + \frac{y}{a} \cdot \left(z - t\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019306 
(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.07612662163899753e-10) (+ x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2.8944268627920891e-49) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))

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