Average Error: 6.2 → 0.9
Time: 2.4s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} = -\infty \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \le 9.73935065370430761 \cdot 10^{290}\right):\\ \;\;\;\;x + y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} = -\infty \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \le 9.73935065370430761 \cdot 10^{290}\right):\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r361338 = x;
        double r361339 = y;
        double r361340 = z;
        double r361341 = r361340 - r361338;
        double r361342 = r361339 * r361341;
        double r361343 = t;
        double r361344 = r361342 / r361343;
        double r361345 = r361338 + r361344;
        return r361345;
}

double f(double x, double y, double z, double t) {
        double r361346 = x;
        double r361347 = y;
        double r361348 = z;
        double r361349 = r361348 - r361346;
        double r361350 = r361347 * r361349;
        double r361351 = t;
        double r361352 = r361350 / r361351;
        double r361353 = r361346 + r361352;
        double r361354 = -inf.0;
        bool r361355 = r361353 <= r361354;
        double r361356 = 9.739350653704308e+290;
        bool r361357 = r361353 <= r361356;
        double r361358 = !r361357;
        bool r361359 = r361355 || r361358;
        double r361360 = r361349 / r361351;
        double r361361 = r361347 * r361360;
        double r361362 = r361346 + r361361;
        double r361363 = r361359 ? r361362 : r361353;
        return r361363;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.2
Target2.0
Herbie0.9
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 2 regimes
  2. if (+ x (/ (* y (- z x)) t)) < -inf.0 or 9.739350653704308e+290 < (+ x (/ (* y (- z x)) t))

    1. Initial program 55.2

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

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

      \[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{z - x}{t}}\]
    5. Simplified2.9

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

    if -inf.0 < (+ x (/ (* y (- z x)) t)) < 9.739350653704308e+290

    1. Initial program 0.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} = -\infty \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \le 9.73935065370430761 \cdot 10^{290}\right):\\ \;\;\;\;x + y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \end{array}\]

Reproduce

herbie shell --seed 2020046 +o rules:numerics
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
  :precision binary64

  :herbie-target
  (- x (+ (* x (/ y t)) (* (- z) (/ y t))))

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