Average Error: 6.2 → 0.5
Time: 4.4s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -4.066498047026020222506690802038445332874 \cdot 10^{223}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 1.827171822513595294503001801235013170875 \cdot 10^{190}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{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 -4.066498047026020222506690802038445332874 \cdot 10^{223}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\

\mathbf{elif}\;y \cdot \left(z - t\right) \le 1.827171822513595294503001801235013170875 \cdot 10^{190}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{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 r374961 = x;
        double r374962 = y;
        double r374963 = z;
        double r374964 = t;
        double r374965 = r374963 - r374964;
        double r374966 = r374962 * r374965;
        double r374967 = a;
        double r374968 = r374966 / r374967;
        double r374969 = r374961 + r374968;
        return r374969;
}

double f(double x, double y, double z, double t, double a) {
        double r374970 = y;
        double r374971 = z;
        double r374972 = t;
        double r374973 = r374971 - r374972;
        double r374974 = r374970 * r374973;
        double r374975 = -4.06649804702602e+223;
        bool r374976 = r374974 <= r374975;
        double r374977 = x;
        double r374978 = a;
        double r374979 = r374973 / r374978;
        double r374980 = r374970 * r374979;
        double r374981 = r374977 + r374980;
        double r374982 = 1.8271718225135953e+190;
        bool r374983 = r374974 <= r374982;
        double r374984 = r374974 / r374978;
        double r374985 = r374977 + r374984;
        double r374986 = r374978 / r374973;
        double r374987 = r374970 / r374986;
        double r374988 = r374977 + r374987;
        double r374989 = r374983 ? r374985 : r374988;
        double r374990 = r374976 ? r374981 : r374989;
        return r374990;
}

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.2
Target0.7
Herbie0.5
\[\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)) < -4.06649804702602e+223

    1. Initial program 31.4

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

      \[\leadsto x + \frac{y \cdot \left(z - t\right)}{\color{blue}{1 \cdot a}}\]
    4. Applied times-frac0.8

      \[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{z - t}{a}}\]
    5. Simplified0.8

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

    if -4.06649804702602e+223 < (* y (- z t)) < 1.8271718225135953e+190

    1. Initial program 0.4

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

    if 1.8271718225135953e+190 < (* y (- z t))

    1. Initial program 28.7

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

      \[\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 -4.066498047026020222506690802038445332874 \cdot 10^{223}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 1.827171822513595294503001801235013170875 \cdot 10^{190}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \end{array}\]

Reproduce

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