Average Error: 5.9 → 0.4
Time: 19.4s
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 r18131070 = x;
        double r18131071 = y;
        double r18131072 = z;
        double r18131073 = t;
        double r18131074 = r18131072 - r18131073;
        double r18131075 = r18131071 * r18131074;
        double r18131076 = a;
        double r18131077 = r18131075 / r18131076;
        double r18131078 = r18131070 + r18131077;
        return r18131078;
}

double f(double x, double y, double z, double t, double a) {
        double r18131079 = z;
        double r18131080 = t;
        double r18131081 = r18131079 - r18131080;
        double r18131082 = y;
        double r18131083 = r18131081 * r18131082;
        double r18131084 = -4.618089068903109e+281;
        bool r18131085 = r18131083 <= r18131084;
        double r18131086 = x;
        double r18131087 = a;
        double r18131088 = r18131087 / r18131081;
        double r18131089 = r18131082 / r18131088;
        double r18131090 = r18131086 + r18131089;
        double r18131091 = 2.188403885491514e+229;
        bool r18131092 = r18131083 <= r18131091;
        double r18131093 = r18131083 / r18131087;
        double r18131094 = r18131093 + r18131086;
        double r18131095 = r18131092 ? r18131094 : r18131090;
        double r18131096 = r18131085 ? r18131090 : r18131095;
        return r18131096;
}

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