Average Error: 6.0 → 0.8
Time: 4.7s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -3.0637893463441613 \cdot 10^{62} \lor \neg \left(y \le 8.1614470454838748 \cdot 10^{-13}\right):\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;\left(x + \frac{t \cdot y}{a}\right) - \frac{z \cdot y}{a}\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \le -3.0637893463441613 \cdot 10^{62} \lor \neg \left(y \le 8.1614470454838748 \cdot 10^{-13}\right):\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r316193 = x;
        double r316194 = y;
        double r316195 = z;
        double r316196 = t;
        double r316197 = r316195 - r316196;
        double r316198 = r316194 * r316197;
        double r316199 = a;
        double r316200 = r316198 / r316199;
        double r316201 = r316193 - r316200;
        return r316201;
}

double f(double x, double y, double z, double t, double a) {
        double r316202 = y;
        double r316203 = -3.0637893463441613e+62;
        bool r316204 = r316202 <= r316203;
        double r316205 = 8.161447045483875e-13;
        bool r316206 = r316202 <= r316205;
        double r316207 = !r316206;
        bool r316208 = r316204 || r316207;
        double r316209 = x;
        double r316210 = a;
        double r316211 = z;
        double r316212 = t;
        double r316213 = r316211 - r316212;
        double r316214 = r316210 / r316213;
        double r316215 = r316202 / r316214;
        double r316216 = r316209 - r316215;
        double r316217 = r316212 * r316202;
        double r316218 = r316217 / r316210;
        double r316219 = r316209 + r316218;
        double r316220 = r316211 * r316202;
        double r316221 = r316220 / r316210;
        double r316222 = r316219 - r316221;
        double r316223 = r316208 ? r316216 : r316222;
        return r316223;
}

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
Herbie0.8
\[\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 2 regimes
  2. if y < -3.0637893463441613e+62 or 8.161447045483875e-13 < y

    1. Initial program 16.1

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

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

    if -3.0637893463441613e+62 < y < 8.161447045483875e-13

    1. Initial program 0.8

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

      \[\leadsto x - \color{blue}{\frac{y}{\frac{a}{z - t}}}\]
    4. Taylor expanded around 0 0.8

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

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

Reproduce

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