Average Error: 6.4 → 0.5
Time: 3.5s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -2.689959535719968 \cdot 10^{288}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 3.12395947034459992 \cdot 10^{186}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \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 \cdot \left(z - t\right) \le -2.689959535719968 \cdot 10^{288}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r290263 = x;
        double r290264 = y;
        double r290265 = z;
        double r290266 = t;
        double r290267 = r290265 - r290266;
        double r290268 = r290264 * r290267;
        double r290269 = a;
        double r290270 = r290268 / r290269;
        double r290271 = r290263 + r290270;
        return r290271;
}

double f(double x, double y, double z, double t, double a) {
        double r290272 = y;
        double r290273 = z;
        double r290274 = t;
        double r290275 = r290273 - r290274;
        double r290276 = r290272 * r290275;
        double r290277 = -2.689959535719968e+288;
        bool r290278 = r290276 <= r290277;
        double r290279 = x;
        double r290280 = a;
        double r290281 = r290275 / r290280;
        double r290282 = r290272 * r290281;
        double r290283 = r290279 + r290282;
        double r290284 = 3.1239594703446e+186;
        bool r290285 = r290276 <= r290284;
        double r290286 = r290276 / r290280;
        double r290287 = r290279 + r290286;
        double r290288 = r290280 / r290275;
        double r290289 = r290272 / r290288;
        double r290290 = r290279 + r290289;
        double r290291 = r290285 ? r290287 : r290290;
        double r290292 = r290278 ? r290283 : r290291;
        return r290292;
}

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.8
Herbie0.5
\[\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 3 regimes
  2. if (* y (- z t)) < -2.689959535719968e+288

    1. Initial program 54.0

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

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

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

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

    if -2.689959535719968e+288 < (* y (- z t)) < 3.1239594703446e+186

    1. Initial program 0.5

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

    if 3.1239594703446e+186 < (* y (- z t))

    1. Initial program 26.6

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

      \[\leadsto x + \color{blue}{\frac{y}{\frac{a}{z - t}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.5

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

Reproduce

herbie shell --seed 2020081 +o rules:numerics
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
  :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)))