Average Error: 5.9 → 2.0
Time: 35.5s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.347255096019191366668939936449476710141 \cdot 10^{47}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{elif}\;y \le 2.40363893826746579460827042444779171101 \cdot 10^{-47}:\\ \;\;\;\;x + \left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{1}{z - x}}{\frac{y}{t}}} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;y \le -1.347255096019191366668939936449476710141 \cdot 10^{47}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r299696 = x;
        double r299697 = y;
        double r299698 = z;
        double r299699 = r299698 - r299696;
        double r299700 = r299697 * r299699;
        double r299701 = t;
        double r299702 = r299700 / r299701;
        double r299703 = r299696 + r299702;
        return r299703;
}

double f(double x, double y, double z, double t) {
        double r299704 = y;
        double r299705 = -1.3472550960191914e+47;
        bool r299706 = r299704 <= r299705;
        double r299707 = x;
        double r299708 = t;
        double r299709 = z;
        double r299710 = r299709 - r299707;
        double r299711 = r299708 / r299710;
        double r299712 = r299704 / r299711;
        double r299713 = r299707 + r299712;
        double r299714 = 2.403638938267466e-47;
        bool r299715 = r299704 <= r299714;
        double r299716 = r299704 * r299710;
        double r299717 = 1.0;
        double r299718 = r299717 / r299708;
        double r299719 = r299716 * r299718;
        double r299720 = r299707 + r299719;
        double r299721 = r299717 / r299710;
        double r299722 = r299704 / r299708;
        double r299723 = r299721 / r299722;
        double r299724 = r299717 / r299723;
        double r299725 = r299724 + r299707;
        double r299726 = r299715 ? r299720 : r299725;
        double r299727 = r299706 ? r299713 : r299726;
        return r299727;
}

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

Derivation

  1. Split input into 3 regimes
  2. if y < -1.3472550960191914e+47

    1. Initial program 16.3

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

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

    if -1.3472550960191914e+47 < y < 2.403638938267466e-47

    1. Initial program 1.3

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

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

    if 2.403638938267466e-47 < y

    1. Initial program 11.6

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

      \[\leadsto x + \color{blue}{\frac{y}{\frac{t}{z - x}}}\]
    4. Using strategy rm
    5. Applied div-inv1.8

      \[\leadsto x + \frac{y}{\color{blue}{t \cdot \frac{1}{z - x}}}\]
    6. Applied associate-/r*3.1

      \[\leadsto x + \color{blue}{\frac{\frac{y}{t}}{\frac{1}{z - x}}}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity3.1

      \[\leadsto x + \frac{\frac{y}{\color{blue}{1 \cdot t}}}{\frac{1}{z - x}}\]
    9. Applied *-un-lft-identity3.1

      \[\leadsto x + \frac{\frac{\color{blue}{1 \cdot y}}{1 \cdot t}}{\frac{1}{z - x}}\]
    10. Applied times-frac3.1

      \[\leadsto x + \frac{\color{blue}{\frac{1}{1} \cdot \frac{y}{t}}}{\frac{1}{z - x}}\]
    11. Applied associate-/l*3.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.347255096019191366668939936449476710141 \cdot 10^{47}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{elif}\;y \le 2.40363893826746579460827042444779171101 \cdot 10^{-47}:\\ \;\;\;\;x + \left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{1}{z - x}}{\frac{y}{t}}} + x\\ \end{array}\]

Reproduce

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