Average Error: 6.2 → 1.9
Time: 16.9s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{\left(z - x\right) \cdot y}{t} \le 3.839280362027844 \cdot 10^{-155}:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{elif}\;x + \frac{\left(z - x\right) \cdot y}{t} \le 6.48136672668775 \cdot 10^{+270}:\\ \;\;\;\;x + \frac{\left(z - x\right) \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{z - x}{t} \cdot y + x\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x + \frac{\left(z - x\right) \cdot y}{t} \le 3.839280362027844 \cdot 10^{-155}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r17479224 = x;
        double r17479225 = y;
        double r17479226 = z;
        double r17479227 = r17479226 - r17479224;
        double r17479228 = r17479225 * r17479227;
        double r17479229 = t;
        double r17479230 = r17479228 / r17479229;
        double r17479231 = r17479224 + r17479230;
        return r17479231;
}

double f(double x, double y, double z, double t) {
        double r17479232 = x;
        double r17479233 = z;
        double r17479234 = r17479233 - r17479232;
        double r17479235 = y;
        double r17479236 = r17479234 * r17479235;
        double r17479237 = t;
        double r17479238 = r17479236 / r17479237;
        double r17479239 = r17479232 + r17479238;
        double r17479240 = 3.839280362027844e-155;
        bool r17479241 = r17479239 <= r17479240;
        double r17479242 = r17479235 / r17479237;
        double r17479243 = r17479242 * r17479234;
        double r17479244 = r17479232 + r17479243;
        double r17479245 = 6.48136672668775e+270;
        bool r17479246 = r17479239 <= r17479245;
        double r17479247 = r17479234 / r17479237;
        double r17479248 = r17479247 * r17479235;
        double r17479249 = r17479248 + r17479232;
        double r17479250 = r17479246 ? r17479239 : r17479249;
        double r17479251 = r17479241 ? r17479244 : r17479250;
        return r17479251;
}

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

Derivation

  1. Split input into 3 regimes
  2. if (+ x (/ (* y (- z x)) t)) < 3.839280362027844e-155

    1. Initial program 6.1

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Taylor expanded around 0 6.1

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

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

    if 3.839280362027844e-155 < (+ x (/ (* y (- z x)) t)) < 6.48136672668775e+270

    1. Initial program 0.3

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

    if 6.48136672668775e+270 < (+ x (/ (* y (- z x)) t))

    1. Initial program 34.7

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{\left(z - x\right) \cdot y}{t} \le 3.839280362027844 \cdot 10^{-155}:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{elif}\;x + \frac{\left(z - x\right) \cdot y}{t} \le 6.48136672668775 \cdot 10^{+270}:\\ \;\;\;\;x + \frac{\left(z - x\right) \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{z - x}{t} \cdot y + x\\ \end{array}\]

Reproduce

herbie shell --seed 2019162 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"

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

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