Average Error: 5.8 → 0.4
Time: 4.9s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -9.995484289270434089051779709495019769676 \cdot 10^{266}:\\ \;\;\;\;x + \frac{y}{a} \cdot \left(z - t\right)\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 8.372301841351568798694844482890536564686 \cdot 10^{181}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a}\\ \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 -9.995484289270434089051779709495019769676 \cdot 10^{266}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(z - t\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r457988 = x;
        double r457989 = y;
        double r457990 = z;
        double r457991 = t;
        double r457992 = r457990 - r457991;
        double r457993 = r457989 * r457992;
        double r457994 = a;
        double r457995 = r457993 / r457994;
        double r457996 = r457988 + r457995;
        return r457996;
}

double f(double x, double y, double z, double t, double a) {
        double r457997 = y;
        double r457998 = z;
        double r457999 = t;
        double r458000 = r457998 - r457999;
        double r458001 = r457997 * r458000;
        double r458002 = -9.995484289270434e+266;
        bool r458003 = r458001 <= r458002;
        double r458004 = x;
        double r458005 = a;
        double r458006 = r457997 / r458005;
        double r458007 = r458006 * r458000;
        double r458008 = r458004 + r458007;
        double r458009 = 8.372301841351569e+181;
        bool r458010 = r458001 <= r458009;
        double r458011 = 1.0;
        double r458012 = r458011 / r458005;
        double r458013 = r458001 * r458012;
        double r458014 = r458004 + r458013;
        double r458015 = r458005 / r458000;
        double r458016 = r457997 / r458015;
        double r458017 = r458004 + r458016;
        double r458018 = r458010 ? r458014 : r458017;
        double r458019 = r458003 ? r458008 : r458018;
        return r458019;
}

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

Original5.8
Target0.6
Herbie0.4
\[\begin{array}{l} \mathbf{if}\;y \lt -1.07612662163899753216593153715602325729 \cdot 10^{-10}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a}{z - t}}{y}}\\ \mathbf{elif}\;y \lt 2.894426862792089097262541964056085749132 \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)) < -9.995484289270434e+266

    1. Initial program 46.2

      \[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}}}\]
    4. Using strategy rm
    5. Applied associate-/r/0.2

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

    if -9.995484289270434e+266 < (* y (- z t)) < 8.372301841351569e+181

    1. Initial program 0.3

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

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

    if 8.372301841351569e+181 < (* y (- z t))

    1. Initial program 23.4

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

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

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

Reproduce

herbie shell --seed 2019362 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
  :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)))