Average Error: 5.9 → 0.9
Time: 3.7s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.26579461665352844 \cdot 10^{72} \lor \neg \left(y \le 3.06949616842609493 \cdot 10^{44}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \le -4.26579461665352844 \cdot 10^{72} \lor \neg \left(y \le 3.06949616842609493 \cdot 10^{44}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r392395 = x;
        double r392396 = y;
        double r392397 = z;
        double r392398 = t;
        double r392399 = r392397 - r392398;
        double r392400 = r392396 * r392399;
        double r392401 = a;
        double r392402 = r392400 / r392401;
        double r392403 = r392395 + r392402;
        return r392403;
}

double f(double x, double y, double z, double t, double a) {
        double r392404 = y;
        double r392405 = -4.2657946166535284e+72;
        bool r392406 = r392404 <= r392405;
        double r392407 = 3.069496168426095e+44;
        bool r392408 = r392404 <= r392407;
        double r392409 = !r392408;
        bool r392410 = r392406 || r392409;
        double r392411 = x;
        double r392412 = z;
        double r392413 = t;
        double r392414 = r392412 - r392413;
        double r392415 = a;
        double r392416 = r392414 / r392415;
        double r392417 = r392404 * r392416;
        double r392418 = r392411 + r392417;
        double r392419 = r392404 * r392414;
        double r392420 = r392419 / r392415;
        double r392421 = r392411 + r392420;
        double r392422 = r392410 ? r392418 : r392421;
        return r392422;
}

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.9
\[\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 2 regimes
  2. if y < -4.2657946166535284e+72 or 3.069496168426095e+44 < y

    1. Initial program 18.8

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

      \[\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.2657946166535284e+72 < y < 3.069496168426095e+44

    1. Initial program 0.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -4.26579461665352844 \cdot 10^{72} \lor \neg \left(y \le 3.06949616842609493 \cdot 10^{44}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020065 
(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)))