Average Error: 6.3 → 0.5
Time: 11.5s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a} = -\infty:\\ \;\;\;\;x - \frac{1}{\frac{1}{\frac{z - t}{\frac{a}{y}}}}\\ \mathbf{elif}\;\frac{y \cdot \left(z - t\right)}{a} \le 1.532969307568607748245310550315122934408 \cdot 10^{298}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a} = -\infty:\\
\;\;\;\;x - \frac{1}{\frac{1}{\frac{z - t}{\frac{a}{y}}}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r249269 = x;
        double r249270 = y;
        double r249271 = z;
        double r249272 = t;
        double r249273 = r249271 - r249272;
        double r249274 = r249270 * r249273;
        double r249275 = a;
        double r249276 = r249274 / r249275;
        double r249277 = r249269 - r249276;
        return r249277;
}

double f(double x, double y, double z, double t, double a) {
        double r249278 = y;
        double r249279 = z;
        double r249280 = t;
        double r249281 = r249279 - r249280;
        double r249282 = r249278 * r249281;
        double r249283 = a;
        double r249284 = r249282 / r249283;
        double r249285 = -inf.0;
        bool r249286 = r249284 <= r249285;
        double r249287 = x;
        double r249288 = 1.0;
        double r249289 = r249283 / r249278;
        double r249290 = r249281 / r249289;
        double r249291 = r249288 / r249290;
        double r249292 = r249288 / r249291;
        double r249293 = r249287 - r249292;
        double r249294 = 1.5329693075686077e+298;
        bool r249295 = r249284 <= r249294;
        double r249296 = r249287 - r249284;
        double r249297 = r249281 / r249283;
        double r249298 = r249278 * r249297;
        double r249299 = r249287 - r249298;
        double r249300 = r249295 ? r249296 : r249299;
        double r249301 = r249286 ? r249293 : r249300;
        return r249301;
}

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.3
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)) a) < -inf.0

    1. Initial program 64.0

      \[x - \frac{y \cdot \left(z - t\right)}{a}\]
    2. Using strategy rm
    3. Applied clear-num64.0

      \[\leadsto x - \color{blue}{\frac{1}{\frac{a}{y \cdot \left(z - t\right)}}}\]
    4. Using strategy rm
    5. Applied associate-/r*0.3

      \[\leadsto x - \frac{1}{\color{blue}{\frac{\frac{a}{y}}{z - t}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity0.3

      \[\leadsto x - \frac{1}{\frac{\frac{a}{\color{blue}{1 \cdot y}}}{z - t}}\]
    8. Applied *-un-lft-identity0.3

      \[\leadsto x - \frac{1}{\frac{\frac{\color{blue}{1 \cdot a}}{1 \cdot y}}{z - t}}\]
    9. Applied times-frac0.3

      \[\leadsto x - \frac{1}{\frac{\color{blue}{\frac{1}{1} \cdot \frac{a}{y}}}{z - t}}\]
    10. Applied associate-/l*0.3

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

    if -inf.0 < (/ (* y (- z t)) a) < 1.5329693075686077e+298

    1. Initial program 0.4

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

    if 1.5329693075686077e+298 < (/ (* y (- z t)) a)

    1. Initial program 58.5

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

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

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

      \[\leadsto x - \color{blue}{y} \cdot \frac{z - t}{a}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a} = -\infty:\\ \;\;\;\;x - \frac{1}{\frac{1}{\frac{z - t}{\frac{a}{y}}}}\\ \mathbf{elif}\;\frac{y \cdot \left(z - t\right)}{a} \le 1.532969307568607748245310550315122934408 \cdot 10^{298}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019212 
(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.07612662163899753e-10) (- x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2.8944268627920891e-49) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t))))))

  (- x (/ (* y (- z t)) a)))