Average Error: 6.4 → 1.3
Time: 50.7s
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 \frac{z - t}{a}\\ \mathbf{elif}\;y \le 6.304490465562008580777481844716509272673 \cdot 10^{-114}:\\ \;\;\;\;\frac{y \cdot \left(z - t\right)}{a} + x\\ \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 -4.292867508096600443770196014802005652851 \cdot 10^{72}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r18076407 = x;
        double r18076408 = y;
        double r18076409 = z;
        double r18076410 = t;
        double r18076411 = r18076409 - r18076410;
        double r18076412 = r18076408 * r18076411;
        double r18076413 = a;
        double r18076414 = r18076412 / r18076413;
        double r18076415 = r18076407 + r18076414;
        return r18076415;
}

double f(double x, double y, double z, double t, double a) {
        double r18076416 = y;
        double r18076417 = -4.2928675080966004e+72;
        bool r18076418 = r18076416 <= r18076417;
        double r18076419 = x;
        double r18076420 = z;
        double r18076421 = t;
        double r18076422 = r18076420 - r18076421;
        double r18076423 = a;
        double r18076424 = r18076422 / r18076423;
        double r18076425 = r18076416 * r18076424;
        double r18076426 = r18076419 + r18076425;
        double r18076427 = 6.3044904655620086e-114;
        bool r18076428 = r18076416 <= r18076427;
        double r18076429 = r18076416 * r18076422;
        double r18076430 = r18076429 / r18076423;
        double r18076431 = r18076430 + r18076419;
        double r18076432 = r18076423 / r18076422;
        double r18076433 = r18076416 / r18076432;
        double r18076434 = r18076419 + r18076433;
        double r18076435 = r18076428 ? r18076431 : r18076434;
        double r18076436 = r18076418 ? r18076426 : r18076435;
        return r18076436;
}

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 3 regimes
  2. if y < -4.2928675080966004e+72

    1. Initial program 20.9

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

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

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

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

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

    1. Initial program 1.0

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

    if 6.3044904655620086e-114 < y

    1. Initial program 9.9

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

      \[\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 -4.292867508096600443770196014802005652851 \cdot 10^{72}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \le 6.304490465562008580777481844716509272673 \cdot 10^{-114}:\\ \;\;\;\;\frac{y \cdot \left(z - t\right)}{a} + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \end{array}\]

Reproduce

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

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