Average Error: 6.4 → 1.3
Time: 49.1s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.292867508096600443770196014802005652851 \cdot 10^{72}:\\ \;\;\;\;x + y \cdot \left(\frac{t}{a} - \frac{z}{a}\right)\\ \mathbf{elif}\;y \le 6.304490465562008580777481844716509272673 \cdot 10^{-114}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(\frac{t}{a} - \frac{z}{a}\right)\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \le -4.292867508096600443770196014802005652851 \cdot 10^{72}:\\
\;\;\;\;x + y \cdot \left(\frac{t}{a} - \frac{z}{a}\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r16759281 = x;
        double r16759282 = y;
        double r16759283 = z;
        double r16759284 = t;
        double r16759285 = r16759283 - r16759284;
        double r16759286 = r16759282 * r16759285;
        double r16759287 = a;
        double r16759288 = r16759286 / r16759287;
        double r16759289 = r16759281 - r16759288;
        return r16759289;
}

double f(double x, double y, double z, double t, double a) {
        double r16759290 = y;
        double r16759291 = -4.2928675080966004e+72;
        bool r16759292 = r16759290 <= r16759291;
        double r16759293 = x;
        double r16759294 = t;
        double r16759295 = a;
        double r16759296 = r16759294 / r16759295;
        double r16759297 = z;
        double r16759298 = r16759297 / r16759295;
        double r16759299 = r16759296 - r16759298;
        double r16759300 = r16759290 * r16759299;
        double r16759301 = r16759293 + r16759300;
        double r16759302 = 6.3044904655620086e-114;
        bool r16759303 = r16759290 <= r16759302;
        double r16759304 = r16759297 - r16759294;
        double r16759305 = r16759290 * r16759304;
        double r16759306 = r16759305 / r16759295;
        double r16759307 = r16759293 - r16759306;
        double r16759308 = r16759303 ? r16759307 : r16759301;
        double r16759309 = r16759292 ? r16759301 : r16759308;
        return r16759309;
}

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.4
Target0.7
Herbie1.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 < -4.2928675080966004e+72 or 6.3044904655620086e-114 < y

    1. Initial program 13.3

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

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

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

    if -4.2928675080966004e+72 < y < 6.3044904655620086e-114

    1. Initial program 1.0

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

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

Reproduce

herbie shell --seed 2019168 
(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.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t))))))

  (- x (/ (* y (- z t)) a)))