Average Error: 6.5 → 0.9
Time: 3.2s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} = -\infty \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \le 1.3494005157116993 \cdot 10^{294}\right):\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} = -\infty \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \le 1.3494005157116993 \cdot 10^{294}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r314822 = x;
        double r314823 = y;
        double r314824 = z;
        double r314825 = r314824 - r314822;
        double r314826 = r314823 * r314825;
        double r314827 = t;
        double r314828 = r314826 / r314827;
        double r314829 = r314822 + r314828;
        return r314829;
}

double f(double x, double y, double z, double t) {
        double r314830 = x;
        double r314831 = y;
        double r314832 = z;
        double r314833 = r314832 - r314830;
        double r314834 = r314831 * r314833;
        double r314835 = t;
        double r314836 = r314834 / r314835;
        double r314837 = r314830 + r314836;
        double r314838 = -inf.0;
        bool r314839 = r314837 <= r314838;
        double r314840 = 1.3494005157116993e+294;
        bool r314841 = r314837 <= r314840;
        double r314842 = !r314841;
        bool r314843 = r314839 || r314842;
        double r314844 = r314831 / r314835;
        double r314845 = r314844 * r314833;
        double r314846 = r314830 + r314845;
        double r314847 = r314843 ? r314846 : r314837;
        return r314847;
}

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.5
Target2.0
Herbie0.9
\[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 (/ (* y (- z x)) t)) < -inf.0 or 1.3494005157116993e+294 < (+ x (/ (* y (- z x)) t))

    1. Initial program 56.0

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

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

      \[\leadsto x + \frac{1}{\color{blue}{\frac{\frac{t}{y}}{z - x}}}\]
    6. Using strategy rm
    7. Applied div-inv0.8

      \[\leadsto x + \frac{1}{\color{blue}{\frac{t}{y} \cdot \frac{1}{z - x}}}\]
    8. Applied add-cube-cbrt0.8

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

      \[\leadsto x + \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{t}{y}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{z - x}}}\]
    10. Simplified1.0

      \[\leadsto x + \color{blue}{\frac{y}{t}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{z - x}}\]
    11. Simplified0.9

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

    if -inf.0 < (+ x (/ (* y (- z x)) t)) < 1.3494005157116993e+294

    1. Initial program 0.9

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

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

      \[\leadsto x + \frac{1}{\color{blue}{\frac{\frac{t}{y}}{z - x}}}\]
    6. Using strategy rm
    7. Applied div-inv2.0

      \[\leadsto x + \frac{1}{\color{blue}{\frac{t}{y} \cdot \frac{1}{z - x}}}\]
    8. Applied add-cube-cbrt2.0

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

      \[\leadsto x + \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{t}{y}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{z - x}}}\]
    10. Simplified2.1

      \[\leadsto x + \color{blue}{\frac{y}{t}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{z - x}}\]
    11. Simplified2.1

      \[\leadsto x + \frac{y}{t} \cdot \color{blue}{\left(z - x\right)}\]
    12. Using strategy rm
    13. Applied associate-*l/0.9

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

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

Reproduce

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