Average Error: 6.3 → 1.4
Time: 9.0s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -4.9168923767645714 \cdot 10^{80}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 2.08730857278766648 \cdot 10^{115}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \cdot \left(z - t\right) \le -4.9168923767645714 \cdot 10^{80}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r439455 = x;
        double r439456 = y;
        double r439457 = z;
        double r439458 = t;
        double r439459 = r439457 - r439458;
        double r439460 = r439456 * r439459;
        double r439461 = a;
        double r439462 = r439460 / r439461;
        double r439463 = r439455 - r439462;
        return r439463;
}

double f(double x, double y, double z, double t, double a) {
        double r439464 = y;
        double r439465 = z;
        double r439466 = t;
        double r439467 = r439465 - r439466;
        double r439468 = r439464 * r439467;
        double r439469 = -4.916892376764571e+80;
        bool r439470 = r439468 <= r439469;
        double r439471 = x;
        double r439472 = a;
        double r439473 = r439472 / r439467;
        double r439474 = r439464 / r439473;
        double r439475 = r439471 - r439474;
        double r439476 = 2.0873085727876665e+115;
        bool r439477 = r439468 <= r439476;
        double r439478 = r439468 / r439472;
        double r439479 = r439471 - r439478;
        double r439480 = r439464 / r439472;
        double r439481 = r439480 * r439467;
        double r439482 = r439471 - r439481;
        double r439483 = r439477 ? r439479 : r439482;
        double r439484 = r439470 ? r439475 : r439483;
        return r439484;
}

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.4
\[\begin{array}{l} \mathbf{if}\;y \lt -1.07612662163899753 \cdot 10^{-10}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{z - t}}{y}}\\ \mathbf{elif}\;y \lt 2.8944268627920891 \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 (* y (- z t)) < -4.916892376764571e+80

    1. Initial program 14.6

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

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

    if -4.916892376764571e+80 < (* y (- z t)) < 2.0873085727876665e+115

    1. Initial program 0.5

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

    if 2.0873085727876665e+115 < (* y (- z t))

    1. Initial program 18.1

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

      \[\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)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -4.9168923767645714 \cdot 10^{80}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 2.08730857278766648 \cdot 10^{115}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\ \end{array}\]

Reproduce

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