Average Error: 6.3 → 0.3
Time: 14.2s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -1.228545789561995196537384183128883239661 \cdot 10^{306} \lor \neg \left(y \cdot \left(z - t\right) \le 8.251338783818022735263242037079282321832 \cdot 10^{226}\right):\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot z + y \cdot \left(-t\right)}{a}\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \cdot \left(z - t\right) \le -1.228545789561995196537384183128883239661 \cdot 10^{306} \lor \neg \left(y \cdot \left(z - t\right) \le 8.251338783818022735263242037079282321832 \cdot 10^{226}\right):\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r236519 = x;
        double r236520 = y;
        double r236521 = z;
        double r236522 = t;
        double r236523 = r236521 - r236522;
        double r236524 = r236520 * r236523;
        double r236525 = a;
        double r236526 = r236524 / r236525;
        double r236527 = r236519 - r236526;
        return r236527;
}

double f(double x, double y, double z, double t, double a) {
        double r236528 = y;
        double r236529 = z;
        double r236530 = t;
        double r236531 = r236529 - r236530;
        double r236532 = r236528 * r236531;
        double r236533 = -1.2285457895619952e+306;
        bool r236534 = r236532 <= r236533;
        double r236535 = 8.251338783818023e+226;
        bool r236536 = r236532 <= r236535;
        double r236537 = !r236536;
        bool r236538 = r236534 || r236537;
        double r236539 = x;
        double r236540 = a;
        double r236541 = r236531 / r236540;
        double r236542 = r236528 * r236541;
        double r236543 = r236539 - r236542;
        double r236544 = r236528 * r236529;
        double r236545 = -r236530;
        double r236546 = r236528 * r236545;
        double r236547 = r236544 + r236546;
        double r236548 = r236547 / r236540;
        double r236549 = r236539 - r236548;
        double r236550 = r236538 ? r236543 : r236549;
        return r236550;
}

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.6
Herbie0.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 2 regimes
  2. if (* y (- z t)) < -1.2285457895619952e+306 or 8.251338783818023e+226 < (* y (- z t))

    1. Initial program 43.9

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

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

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

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

    if -1.2285457895619952e+306 < (* y (- z t)) < 8.251338783818023e+226

    1. Initial program 0.3

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

      \[\leadsto x - \frac{y \cdot \color{blue}{\left(z + \left(-t\right)\right)}}{a}\]
    4. Applied distribute-lft-in0.3

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

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

Reproduce

herbie shell --seed 2019322 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
  :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)))