Average Error: 5.9 → 1.4
Time: 12.1s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.030076365782163826617704959860214083217 \cdot 10^{57} \lor \neg \left(t \le 8.729975090878233774071427402646563246242 \cdot 10^{-288}\right):\\ \;\;\;\;\left(y \cdot \frac{\sqrt[3]{z - x} \cdot \sqrt[3]{z - x}}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\right) \cdot \frac{\sqrt[3]{z - x}}{\sqrt[3]{t}} + x\\ \mathbf{else}:\\ \;\;\;\;\left(\left(z - x\right) \cdot y\right) \cdot \frac{1}{t} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;t \le -1.030076365782163826617704959860214083217 \cdot 10^{57} \lor \neg \left(t \le 8.729975090878233774071427402646563246242 \cdot 10^{-288}\right):\\
\;\;\;\;\left(y \cdot \frac{\sqrt[3]{z - x} \cdot \sqrt[3]{z - x}}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\right) \cdot \frac{\sqrt[3]{z - x}}{\sqrt[3]{t}} + x\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r219179 = x;
        double r219180 = y;
        double r219181 = z;
        double r219182 = r219181 - r219179;
        double r219183 = r219180 * r219182;
        double r219184 = t;
        double r219185 = r219183 / r219184;
        double r219186 = r219179 + r219185;
        return r219186;
}

double f(double x, double y, double z, double t) {
        double r219187 = t;
        double r219188 = -1.0300763657821638e+57;
        bool r219189 = r219187 <= r219188;
        double r219190 = 8.729975090878234e-288;
        bool r219191 = r219187 <= r219190;
        double r219192 = !r219191;
        bool r219193 = r219189 || r219192;
        double r219194 = y;
        double r219195 = z;
        double r219196 = x;
        double r219197 = r219195 - r219196;
        double r219198 = cbrt(r219197);
        double r219199 = r219198 * r219198;
        double r219200 = cbrt(r219187);
        double r219201 = r219200 * r219200;
        double r219202 = r219199 / r219201;
        double r219203 = r219194 * r219202;
        double r219204 = r219198 / r219200;
        double r219205 = r219203 * r219204;
        double r219206 = r219205 + r219196;
        double r219207 = r219197 * r219194;
        double r219208 = 1.0;
        double r219209 = r219208 / r219187;
        double r219210 = r219207 * r219209;
        double r219211 = r219210 + r219196;
        double r219212 = r219193 ? r219206 : r219211;
        return r219212;
}

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

Original5.9
Target2.1
Herbie1.4
\[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.0300763657821638e+57 or 8.729975090878234e-288 < t

    1. Initial program 7.3

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef1.8

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

      \[\leadsto \color{blue}{y \cdot \frac{z - x}{t}} + x\]
    6. Using strategy rm
    7. Applied add-cube-cbrt4.8

      \[\leadsto y \cdot \frac{z - x}{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}} + x\]
    8. Applied add-cube-cbrt4.9

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

      \[\leadsto y \cdot \color{blue}{\left(\frac{\sqrt[3]{z - x} \cdot \sqrt[3]{z - x}}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{\sqrt[3]{z - x}}{\sqrt[3]{t}}\right)} + x\]
    10. Applied associate-*r*1.2

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

    if -1.0300763657821638e+57 < t < 8.729975090878234e-288

    1. Initial program 1.9

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef3.2

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

      \[\leadsto \color{blue}{y \cdot \frac{z - x}{t}} + x\]
    6. Using strategy rm
    7. Applied div-inv13.4

      \[\leadsto y \cdot \color{blue}{\left(\left(z - x\right) \cdot \frac{1}{t}\right)} + x\]
    8. Applied associate-*r*1.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.030076365782163826617704959860214083217 \cdot 10^{57} \lor \neg \left(t \le 8.729975090878233774071427402646563246242 \cdot 10^{-288}\right):\\ \;\;\;\;\left(y \cdot \frac{\sqrt[3]{z - x} \cdot \sqrt[3]{z - x}}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\right) \cdot \frac{\sqrt[3]{z - x}}{\sqrt[3]{t}} + x\\ \mathbf{else}:\\ \;\;\;\;\left(\left(z - x\right) \cdot y\right) \cdot \frac{1}{t} + x\\ \end{array}\]

Reproduce

herbie shell --seed 2019305 +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)))