Average Error: 5.9 → 0.4
Time: 17.8s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;\left(z - t\right) \cdot y \le -4.618089068903109 \cdot 10^{+281}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;\left(z - t\right) \cdot y \le 2.188403885491514 \cdot 10^{+229}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{a} + x\\ \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}\;\left(z - t\right) \cdot y \le -4.618089068903109 \cdot 10^{+281}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r16739216 = x;
        double r16739217 = y;
        double r16739218 = z;
        double r16739219 = t;
        double r16739220 = r16739218 - r16739219;
        double r16739221 = r16739217 * r16739220;
        double r16739222 = a;
        double r16739223 = r16739221 / r16739222;
        double r16739224 = r16739216 + r16739223;
        return r16739224;
}

double f(double x, double y, double z, double t, double a) {
        double r16739225 = z;
        double r16739226 = t;
        double r16739227 = r16739225 - r16739226;
        double r16739228 = y;
        double r16739229 = r16739227 * r16739228;
        double r16739230 = -4.618089068903109e+281;
        bool r16739231 = r16739229 <= r16739230;
        double r16739232 = x;
        double r16739233 = a;
        double r16739234 = r16739233 / r16739227;
        double r16739235 = r16739228 / r16739234;
        double r16739236 = r16739232 + r16739235;
        double r16739237 = 2.188403885491514e+229;
        bool r16739238 = r16739229 <= r16739237;
        double r16739239 = r16739229 / r16739233;
        double r16739240 = r16739239 + r16739232;
        double r16739241 = r16739238 ? r16739240 : r16739236;
        double r16739242 = r16739231 ? r16739236 : r16739241;
        return r16739242;
}

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.9
Target0.7
Herbie0.4
\[\begin{array}{l} \mathbf{if}\;y \lt -1.0761266216389975 \cdot 10^{-10}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a}{z - t}}{y}}\\ \mathbf{elif}\;y \lt 2.894426862792089 \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 2 regimes
  2. if (* y (- z t)) < -4.618089068903109e+281 or 2.188403885491514e+229 < (* y (- z t))

    1. Initial program 39.5

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

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

    if -4.618089068903109e+281 < (* y (- z t)) < 2.188403885491514e+229

    1. Initial program 0.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z - t\right) \cdot y \le -4.618089068903109 \cdot 10^{+281}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;\left(z - t\right) \cdot y \le 2.188403885491514 \cdot 10^{+229}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{a} + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019162 +o rules:numerics
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"

  :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)))