Average Error: 6.2 → 1.6
Time: 10.1s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - t\right)}{a} \le -9.58097381083328705154269126658672692522 \cdot 10^{81}:\\ \;\;\;\;x + \frac{y}{a} \cdot \left(z - t\right)\\ \mathbf{elif}\;x + \frac{y \cdot \left(z - t\right)}{a} \le 4.84668724673702282414318349461758654708 \cdot 10^{282}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(z - t\right)}{a} \le -9.58097381083328705154269126658672692522 \cdot 10^{81}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(z - t\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r254334 = x;
        double r254335 = y;
        double r254336 = z;
        double r254337 = t;
        double r254338 = r254336 - r254337;
        double r254339 = r254335 * r254338;
        double r254340 = a;
        double r254341 = r254339 / r254340;
        double r254342 = r254334 + r254341;
        return r254342;
}

double f(double x, double y, double z, double t, double a) {
        double r254343 = x;
        double r254344 = y;
        double r254345 = z;
        double r254346 = t;
        double r254347 = r254345 - r254346;
        double r254348 = r254344 * r254347;
        double r254349 = a;
        double r254350 = r254348 / r254349;
        double r254351 = r254343 + r254350;
        double r254352 = -9.580973810833287e+81;
        bool r254353 = r254351 <= r254352;
        double r254354 = r254344 / r254349;
        double r254355 = r254354 * r254347;
        double r254356 = r254343 + r254355;
        double r254357 = 4.846687246737023e+282;
        bool r254358 = r254351 <= r254357;
        double r254359 = r254347 / r254349;
        double r254360 = r254344 * r254359;
        double r254361 = r254343 + r254360;
        double r254362 = r254358 ? r254351 : r254361;
        double r254363 = r254353 ? r254356 : r254362;
        return r254363;
}

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.2
Target0.7
Herbie1.6
\[\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 (+ x (/ (* y (- z t)) a)) < -9.580973810833287e+81

    1. Initial program 9.1

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

      \[\leadsto x + \color{blue}{\frac{y}{\frac{a}{z - t}}}\]
    4. Using strategy rm
    5. Applied associate-/r/2.2

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

    if -9.580973810833287e+81 < (+ x (/ (* y (- z t)) a)) < 4.846687246737023e+282

    1. Initial program 0.6

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

    if 4.846687246737023e+282 < (+ x (/ (* y (- z t)) a))

    1. Initial program 38.1

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

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

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

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

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

Reproduce

herbie shell --seed 2019208 
(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.07612662163899753e-10) (+ x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2.8944268627920891e-49) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))

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