Average Error: 6.6 → 1.5
Time: 4.2s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.1004328628550222 \cdot 10^{22} \lor \neg \left(t \le 9.4145976086734718 \cdot 10^{-54}\right):\\ \;\;\;\;x + y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{z \cdot y}{t} - \frac{x \cdot y}{t}\right)\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;t \le -1.1004328628550222 \cdot 10^{22} \lor \neg \left(t \le 9.4145976086734718 \cdot 10^{-54}\right):\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r335370 = x;
        double r335371 = y;
        double r335372 = z;
        double r335373 = r335372 - r335370;
        double r335374 = r335371 * r335373;
        double r335375 = t;
        double r335376 = r335374 / r335375;
        double r335377 = r335370 + r335376;
        return r335377;
}

double f(double x, double y, double z, double t) {
        double r335378 = t;
        double r335379 = -1.1004328628550222e+22;
        bool r335380 = r335378 <= r335379;
        double r335381 = 9.414597608673472e-54;
        bool r335382 = r335378 <= r335381;
        double r335383 = !r335382;
        bool r335384 = r335380 || r335383;
        double r335385 = x;
        double r335386 = y;
        double r335387 = z;
        double r335388 = r335387 - r335385;
        double r335389 = r335388 / r335378;
        double r335390 = r335386 * r335389;
        double r335391 = r335385 + r335390;
        double r335392 = r335387 * r335386;
        double r335393 = r335392 / r335378;
        double r335394 = r335385 * r335386;
        double r335395 = r335394 / r335378;
        double r335396 = r335393 - r335395;
        double r335397 = r335385 + r335396;
        double r335398 = r335384 ? r335391 : r335397;
        return r335398;
}

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

Derivation

  1. Split input into 2 regimes
  2. if t < -1.1004328628550222e+22 or 9.414597608673472e-54 < t

    1. Initial program 9.1

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

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

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

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

    if -1.1004328628550222e+22 < t < 9.414597608673472e-54

    1. Initial program 1.9

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt2.8

      \[\leadsto x + \frac{y \cdot \left(z - x\right)}{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}}\]
    4. Applied times-frac6.8

      \[\leadsto x + \color{blue}{\frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z - x}{\sqrt[3]{t}}}\]
    5. Taylor expanded around 0 1.9

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

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

Reproduce

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