Average Error: 6.0 → 1.0
Time: 1.0m
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -6.935188915578447 \cdot 10^{-59}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;y \le 4.6880760091351194 \cdot 10^{-114}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{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 -6.935188915578447 \cdot 10^{-59}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\

\mathbf{elif}\;y \le 4.6880760091351194 \cdot 10^{-114}:\\
\;\;\;\;\frac{\left(z - t\right) \cdot y}{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 r18814459 = x;
        double r18814460 = y;
        double r18814461 = z;
        double r18814462 = t;
        double r18814463 = r18814461 - r18814462;
        double r18814464 = r18814460 * r18814463;
        double r18814465 = a;
        double r18814466 = r18814464 / r18814465;
        double r18814467 = r18814459 + r18814466;
        return r18814467;
}

double f(double x, double y, double z, double t, double a) {
        double r18814468 = y;
        double r18814469 = -6.935188915578447e-59;
        bool r18814470 = r18814468 <= r18814469;
        double r18814471 = x;
        double r18814472 = a;
        double r18814473 = z;
        double r18814474 = t;
        double r18814475 = r18814473 - r18814474;
        double r18814476 = r18814472 / r18814475;
        double r18814477 = r18814468 / r18814476;
        double r18814478 = r18814471 + r18814477;
        double r18814479 = 4.6880760091351194e-114;
        bool r18814480 = r18814468 <= r18814479;
        double r18814481 = r18814475 * r18814468;
        double r18814482 = r18814481 / r18814472;
        double r18814483 = r18814482 + r18814471;
        double r18814484 = r18814480 ? r18814483 : r18814478;
        double r18814485 = r18814470 ? r18814478 : r18814484;
        return r18814485;
}

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.7
Herbie1.0
\[\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 < -6.935188915578447e-59 or 4.6880760091351194e-114 < y

    1. Initial program 10.5

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

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

    if -6.935188915578447e-59 < y < 4.6880760091351194e-114

    1. Initial program 0.6

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

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

Reproduce

herbie shell --seed 2019168 +o rules:numerics
(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 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))

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