Average Error: 6.5 → 1.3
Time: 3.0s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.5745896431018994 \cdot 10^{66}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \le 1.8297702711364304 \cdot 10^{-148}:\\ \;\;\;\;x + \frac{1}{\frac{a}{y \cdot \left(z - t\right)}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \le -1.5745896431018994 \cdot 10^{66}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r337520 = x;
        double r337521 = y;
        double r337522 = z;
        double r337523 = t;
        double r337524 = r337522 - r337523;
        double r337525 = r337521 * r337524;
        double r337526 = a;
        double r337527 = r337525 / r337526;
        double r337528 = r337520 + r337527;
        return r337528;
}

double f(double x, double y, double z, double t, double a) {
        double r337529 = y;
        double r337530 = -1.5745896431018994e+66;
        bool r337531 = r337529 <= r337530;
        double r337532 = x;
        double r337533 = z;
        double r337534 = t;
        double r337535 = r337533 - r337534;
        double r337536 = a;
        double r337537 = r337535 / r337536;
        double r337538 = r337529 * r337537;
        double r337539 = r337532 + r337538;
        double r337540 = 1.8297702711364304e-148;
        bool r337541 = r337529 <= r337540;
        double r337542 = 1.0;
        double r337543 = r337529 * r337535;
        double r337544 = r337536 / r337543;
        double r337545 = r337542 / r337544;
        double r337546 = r337532 + r337545;
        double r337547 = r337536 / r337535;
        double r337548 = r337529 / r337547;
        double r337549 = r337532 + r337548;
        double r337550 = r337541 ? r337546 : r337549;
        double r337551 = r337531 ? r337539 : r337550;
        return r337551;
}

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.5
Target0.7
Herbie1.3
\[\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 < -1.5745896431018994e+66

    1. Initial program 19.0

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

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

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

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

    if -1.5745896431018994e+66 < y < 1.8297702711364304e-148

    1. Initial program 0.7

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

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

    if 1.8297702711364304e-148 < y

    1. Initial program 10.2

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

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

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

Reproduce

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