Average Error: 5.9 → 0.4
Time: 20.0s
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 r19499224 = x;
        double r19499225 = y;
        double r19499226 = z;
        double r19499227 = t;
        double r19499228 = r19499226 - r19499227;
        double r19499229 = r19499225 * r19499228;
        double r19499230 = a;
        double r19499231 = r19499229 / r19499230;
        double r19499232 = r19499224 + r19499231;
        return r19499232;
}

double f(double x, double y, double z, double t, double a) {
        double r19499233 = z;
        double r19499234 = t;
        double r19499235 = r19499233 - r19499234;
        double r19499236 = y;
        double r19499237 = r19499235 * r19499236;
        double r19499238 = -4.618089068903109e+281;
        bool r19499239 = r19499237 <= r19499238;
        double r19499240 = x;
        double r19499241 = a;
        double r19499242 = r19499241 / r19499235;
        double r19499243 = r19499236 / r19499242;
        double r19499244 = r19499240 + r19499243;
        double r19499245 = 2.188403885491514e+229;
        bool r19499246 = r19499237 <= r19499245;
        double r19499247 = r19499237 / r19499241;
        double r19499248 = r19499247 + r19499240;
        double r19499249 = r19499246 ? r19499248 : r19499244;
        double r19499250 = r19499239 ? r19499244 : r19499249;
        return r19499250;
}

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