Average Error: 6.3 → 1.6
Time: 13.1s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.2820497955036201 \cdot 10^{41}:\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \mathbf{elif}\;t \le 1.02308238722779095 \cdot 10^{-8}:\\ \;\;\;\;x + \left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z - x}{t} \cdot y\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;t \le -1.2820497955036201 \cdot 10^{41}:\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\

\mathbf{elif}\;t \le 1.02308238722779095 \cdot 10^{-8}:\\
\;\;\;\;x + \left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r297423 = x;
        double r297424 = y;
        double r297425 = z;
        double r297426 = r297425 - r297423;
        double r297427 = r297424 * r297426;
        double r297428 = t;
        double r297429 = r297427 / r297428;
        double r297430 = r297423 + r297429;
        return r297430;
}

double f(double x, double y, double z, double t) {
        double r297431 = t;
        double r297432 = -1.28204979550362e+41;
        bool r297433 = r297431 <= r297432;
        double r297434 = x;
        double r297435 = z;
        double r297436 = r297435 - r297434;
        double r297437 = y;
        double r297438 = r297437 / r297431;
        double r297439 = r297436 * r297438;
        double r297440 = r297434 + r297439;
        double r297441 = 1.023082387227791e-08;
        bool r297442 = r297431 <= r297441;
        double r297443 = r297437 * r297436;
        double r297444 = 1.0;
        double r297445 = r297444 / r297431;
        double r297446 = r297443 * r297445;
        double r297447 = r297434 + r297446;
        double r297448 = r297436 / r297431;
        double r297449 = r297448 * r297437;
        double r297450 = r297434 + r297449;
        double r297451 = r297442 ? r297447 : r297450;
        double r297452 = r297433 ? r297440 : r297451;
        return r297452;
}

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.3
Target2.0
Herbie1.6
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 3 regimes
  2. if t < -1.28204979550362e+41

    1. Initial program 10.8

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

      \[\leadsto x + \color{blue}{1 \cdot \frac{y \cdot \left(z - x\right)}{t}}\]
    4. Applied *-un-lft-identity10.8

      \[\leadsto \color{blue}{1 \cdot x} + 1 \cdot \frac{y \cdot \left(z - x\right)}{t}\]
    5. Applied distribute-lft-out10.8

      \[\leadsto \color{blue}{1 \cdot \left(x + \frac{y \cdot \left(z - x\right)}{t}\right)}\]
    6. Simplified1.3

      \[\leadsto 1 \cdot \color{blue}{\left(x + \frac{z - x}{\frac{t}{y}}\right)}\]
    7. Using strategy rm
    8. Applied div-inv1.3

      \[\leadsto 1 \cdot \left(x + \color{blue}{\left(z - x\right) \cdot \frac{1}{\frac{t}{y}}}\right)\]
    9. Taylor expanded around 0 1.2

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

    if -1.28204979550362e+41 < t < 1.023082387227791e-08

    1. Initial program 1.9

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Using strategy rm
    3. Applied div-inv2.0

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

    if 1.023082387227791e-08 < t

    1. Initial program 8.3

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

      \[\leadsto x + \color{blue}{1 \cdot \frac{y \cdot \left(z - x\right)}{t}}\]
    4. Applied *-un-lft-identity8.3

      \[\leadsto \color{blue}{1 \cdot x} + 1 \cdot \frac{y \cdot \left(z - x\right)}{t}\]
    5. Applied distribute-lft-out8.3

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

      \[\leadsto 1 \cdot \color{blue}{\left(x + \frac{z - x}{\frac{t}{y}}\right)}\]
    7. Using strategy rm
    8. Applied associate-/r/1.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.2820497955036201 \cdot 10^{41}:\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \mathbf{elif}\;t \le 1.02308238722779095 \cdot 10^{-8}:\\ \;\;\;\;x + \left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z - x}{t} \cdot y\\ \end{array}\]

Reproduce

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