Average Error: 6.4 → 0.5
Time: 3.6s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -5.275596583469645 \cdot 10^{271}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{y}}{z - t}}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 1.72919691515906818 \cdot 10^{262}:\\ \;\;\;\;x - \frac{1}{a \cdot \frac{1}{y \cdot \left(z - t\right)}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \cdot \left(z - t\right) \le -5.275596583469645 \cdot 10^{271}:\\
\;\;\;\;x - \frac{1}{\frac{\frac{a}{y}}{z - t}}\\

\mathbf{elif}\;y \cdot \left(z - t\right) \le 1.72919691515906818 \cdot 10^{262}:\\
\;\;\;\;x - \frac{1}{a \cdot \frac{1}{y \cdot \left(z - t\right)}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r286690 = x;
        double r286691 = y;
        double r286692 = z;
        double r286693 = t;
        double r286694 = r286692 - r286693;
        double r286695 = r286691 * r286694;
        double r286696 = a;
        double r286697 = r286695 / r286696;
        double r286698 = r286690 - r286697;
        return r286698;
}

double f(double x, double y, double z, double t, double a) {
        double r286699 = y;
        double r286700 = z;
        double r286701 = t;
        double r286702 = r286700 - r286701;
        double r286703 = r286699 * r286702;
        double r286704 = -5.275596583469645e+271;
        bool r286705 = r286703 <= r286704;
        double r286706 = x;
        double r286707 = 1.0;
        double r286708 = a;
        double r286709 = r286708 / r286699;
        double r286710 = r286709 / r286702;
        double r286711 = r286707 / r286710;
        double r286712 = r286706 - r286711;
        double r286713 = 1.7291969151590682e+262;
        bool r286714 = r286703 <= r286713;
        double r286715 = r286707 / r286703;
        double r286716 = r286708 * r286715;
        double r286717 = r286707 / r286716;
        double r286718 = r286706 - r286717;
        double r286719 = r286708 / r286702;
        double r286720 = r286699 / r286719;
        double r286721 = r286706 - r286720;
        double r286722 = r286714 ? r286718 : r286721;
        double r286723 = r286705 ? r286712 : r286722;
        return r286723;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.4
Target0.7
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;y \lt -1.07612662163899753 \cdot 10^{-10}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{z - t}}{y}}\\ \mathbf{elif}\;y \lt 2.8944268627920891 \cdot 10^{-49}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if (* y (- z t)) < -5.275596583469645e+271

    1. Initial program 49.3

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

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

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

    if -5.275596583469645e+271 < (* y (- z t)) < 1.7291969151590682e+262

    1. Initial program 0.4

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

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

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

    if 1.7291969151590682e+262 < (* y (- z t))

    1. Initial program 44.4

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

      \[\leadsto x - \color{blue}{\frac{y}{\frac{a}{z - t}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -5.275596583469645 \cdot 10^{271}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{y}}{z - t}}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 1.72919691515906818 \cdot 10^{262}:\\ \;\;\;\;x - \frac{1}{a \cdot \frac{1}{y \cdot \left(z - t\right)}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020060 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
  :precision binary64

  :herbie-target
  (if (< y -1.0761266216389975e-10) (- x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t))))))

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