Average Error: 6.1 → 0.5
Time: 4.1s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -1.086588240667298 \cdot 10^{268}:\\ \;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 4.3668041271782376 \cdot 10^{219}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\frac{y}{a}}{\frac{1}{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 -1.086588240667298 \cdot 10^{268}:\\
\;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r330215 = x;
        double r330216 = y;
        double r330217 = z;
        double r330218 = t;
        double r330219 = r330217 - r330218;
        double r330220 = r330216 * r330219;
        double r330221 = a;
        double r330222 = r330220 / r330221;
        double r330223 = r330215 - r330222;
        return r330223;
}

double f(double x, double y, double z, double t, double a) {
        double r330224 = y;
        double r330225 = z;
        double r330226 = t;
        double r330227 = r330225 - r330226;
        double r330228 = r330224 * r330227;
        double r330229 = -1.0865882406672983e+268;
        bool r330230 = r330228 <= r330229;
        double r330231 = x;
        double r330232 = a;
        double r330233 = r330224 / r330232;
        double r330234 = r330233 * r330227;
        double r330235 = r330231 - r330234;
        double r330236 = 4.3668041271782376e+219;
        bool r330237 = r330228 <= r330236;
        double r330238 = r330228 / r330232;
        double r330239 = r330231 - r330238;
        double r330240 = 1.0;
        double r330241 = r330240 / r330227;
        double r330242 = r330233 / r330241;
        double r330243 = r330231 - r330242;
        double r330244 = r330237 ? r330239 : r330243;
        double r330245 = r330230 ? r330235 : r330244;
        return r330245;
}

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.1
Target0.7
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;y \lt -1.07612662163899753 \cdot 10^{-10}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{z - t}}{y}}\\ \mathbf{elif}\;y \lt 2.8944268627920891 \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)) < -1.0865882406672983e+268

    1. Initial program 45.8

      \[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 -1.0865882406672983e+268 < (* y (- z t)) < 4.3668041271782376e+219

    1. Initial program 0.5

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

    if 4.3668041271782376e+219 < (* y (- z t))

    1. Initial program 33.5

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

      \[\leadsto x - \color{blue}{\frac{y}{\frac{a}{z - t}}}\]
    4. Using strategy rm
    5. Applied div-inv0.7

      \[\leadsto x - \frac{y}{\color{blue}{a \cdot \frac{1}{z - t}}}\]
    6. Applied associate-/r*0.4

      \[\leadsto x - \color{blue}{\frac{\frac{y}{a}}{\frac{1}{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 -1.086588240667298 \cdot 10^{268}:\\ \;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 4.3668041271782376 \cdot 10^{219}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\frac{y}{a}}{\frac{1}{z - t}}\\ \end{array}\]

Reproduce

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