Average Error: 6.7 → 2.1
Time: 18.6s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.324378283502526917772059572052329230767 \cdot 10^{-242} \lor \neg \left(x \le 9.623040471329404531569079879966998092121 \cdot 10^{-128}\right):\\ \;\;\;\;\left(\left(z - x\right) \cdot \frac{y}{t}\right) \cdot 1 + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x \le -1.324378283502526917772059572052329230767 \cdot 10^{-242} \lor \neg \left(x \le 9.623040471329404531569079879966998092121 \cdot 10^{-128}\right):\\
\;\;\;\;\left(\left(z - x\right) \cdot \frac{y}{t}\right) \cdot 1 + x\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r237765 = x;
        double r237766 = y;
        double r237767 = z;
        double r237768 = r237767 - r237765;
        double r237769 = r237766 * r237768;
        double r237770 = t;
        double r237771 = r237769 / r237770;
        double r237772 = r237765 + r237771;
        return r237772;
}

double f(double x, double y, double z, double t) {
        double r237773 = x;
        double r237774 = -1.324378283502527e-242;
        bool r237775 = r237773 <= r237774;
        double r237776 = 9.623040471329405e-128;
        bool r237777 = r237773 <= r237776;
        double r237778 = !r237777;
        bool r237779 = r237775 || r237778;
        double r237780 = z;
        double r237781 = r237780 - r237773;
        double r237782 = y;
        double r237783 = t;
        double r237784 = r237782 / r237783;
        double r237785 = r237781 * r237784;
        double r237786 = 1.0;
        double r237787 = r237785 * r237786;
        double r237788 = r237787 + r237773;
        double r237789 = r237783 / r237781;
        double r237790 = r237782 / r237789;
        double r237791 = r237773 + r237790;
        double r237792 = r237779 ? r237788 : r237791;
        return r237792;
}

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.7
Target2.0
Herbie2.1
\[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 < -1.324378283502527e-242 or 9.623040471329405e-128 < x

    1. Initial program 7.1

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

      \[\leadsto x + \color{blue}{\frac{1}{\frac{t}{y \cdot \left(z - x\right)}}}\]
    4. Using strategy rm
    5. Applied div-inv7.2

      \[\leadsto x + \frac{1}{\color{blue}{t \cdot \frac{1}{y \cdot \left(z - x\right)}}}\]
    6. Applied add-cube-cbrt7.2

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

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

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

      \[\leadsto x + \frac{1}{t} \cdot \color{blue}{\left(y \cdot \left(z - x\right)\right)}\]
    10. Using strategy rm
    11. Applied *-un-lft-identity7.1

      \[\leadsto x + \frac{1}{\color{blue}{1 \cdot t}} \cdot \left(y \cdot \left(z - x\right)\right)\]
    12. Applied add-cube-cbrt7.1

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

      \[\leadsto x + \color{blue}{\left(\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{t}\right)} \cdot \left(y \cdot \left(z - x\right)\right)\]
    14. Applied associate-*l*7.1

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

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

    if -1.324378283502527e-242 < x < 9.623040471329405e-128

    1. Initial program 5.5

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Using strategy rm
    3. Applied associate-/l*5.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.324378283502526917772059572052329230767 \cdot 10^{-242} \lor \neg \left(x \le 9.623040471329404531569079879966998092121 \cdot 10^{-128}\right):\\ \;\;\;\;\left(\left(z - x\right) \cdot \frac{y}{t}\right) \cdot 1 + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \end{array}\]

Reproduce

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