Average Error: 5.9 → 0.8
Time: 17.0s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(z - t\right) \cdot y}{a} \le -3.44036116890877 \cdot 10^{+238}:\\ \;\;\;\;x - \frac{z - t}{\frac{a}{y}}\\ \mathbf{elif}\;\frac{\left(z - t\right) \cdot y}{a} \le 6.991329072900224 \cdot 10^{+283}:\\ \;\;\;\;x - \frac{\left(z - t\right) \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{z - t}{\frac{a}{y}}\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;\frac{\left(z - t\right) \cdot y}{a} \le -3.44036116890877 \cdot 10^{+238}:\\
\;\;\;\;x - \frac{z - t}{\frac{a}{y}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r13918495 = x;
        double r13918496 = y;
        double r13918497 = z;
        double r13918498 = t;
        double r13918499 = r13918497 - r13918498;
        double r13918500 = r13918496 * r13918499;
        double r13918501 = a;
        double r13918502 = r13918500 / r13918501;
        double r13918503 = r13918495 - r13918502;
        return r13918503;
}

double f(double x, double y, double z, double t, double a) {
        double r13918504 = z;
        double r13918505 = t;
        double r13918506 = r13918504 - r13918505;
        double r13918507 = y;
        double r13918508 = r13918506 * r13918507;
        double r13918509 = a;
        double r13918510 = r13918508 / r13918509;
        double r13918511 = -3.44036116890877e+238;
        bool r13918512 = r13918510 <= r13918511;
        double r13918513 = x;
        double r13918514 = r13918509 / r13918507;
        double r13918515 = r13918506 / r13918514;
        double r13918516 = r13918513 - r13918515;
        double r13918517 = 6.991329072900224e+283;
        bool r13918518 = r13918510 <= r13918517;
        double r13918519 = r13918513 - r13918510;
        double r13918520 = r13918518 ? r13918519 : r13918516;
        double r13918521 = r13918512 ? r13918516 : r13918520;
        return r13918521;
}

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

Original5.9
Target0.7
Herbie0.8
\[\begin{array}{l} \mathbf{if}\;y \lt -1.0761266216389975 \cdot 10^{-10}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{z - t}}{y}}\\ \mathbf{elif}\;y \lt 2.894426862792089 \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)) a) < -3.44036116890877e+238 or 6.991329072900224e+283 < (/ (* y (- z t)) a)

    1. Initial program 39.0

      \[x - \frac{y \cdot \left(z - t\right)}{a}\]
    2. Taylor expanded around 0 39.0

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

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

    if -3.44036116890877e+238 < (/ (* y (- z t)) a) < 6.991329072900224e+283

    1. Initial program 0.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(z - t\right) \cdot y}{a} \le -3.44036116890877 \cdot 10^{+238}:\\ \;\;\;\;x - \frac{z - t}{\frac{a}{y}}\\ \mathbf{elif}\;\frac{\left(z - t\right) \cdot y}{a} \le 6.991329072900224 \cdot 10^{+283}:\\ \;\;\;\;x - \frac{\left(z - t\right) \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{z - t}{\frac{a}{y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019162 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"

  :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)))