Average Error: 6.0 → 1.0
Time: 4.1s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.9481876431266308 \cdot 10^{-46}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \le 4.63564802436255314 \cdot 10^{-177}:\\ \;\;\;\;x - \frac{1}{\frac{a}{y \cdot \left(z - t\right)}}\\ \mathbf{elif}\;y \le 2.802493622680903 \cdot 10^{-65}:\\ \;\;\;\;x - \frac{\frac{y}{a}}{\frac{1}{z - t}}\\ \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}\;y \le -2.9481876431266308 \cdot 10^{-46}:\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\

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

\mathbf{elif}\;y \le 2.802493622680903 \cdot 10^{-65}:\\
\;\;\;\;x - \frac{\frac{y}{a}}{\frac{1}{z - t}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r343307 = x;
        double r343308 = y;
        double r343309 = z;
        double r343310 = t;
        double r343311 = r343309 - r343310;
        double r343312 = r343308 * r343311;
        double r343313 = a;
        double r343314 = r343312 / r343313;
        double r343315 = r343307 - r343314;
        return r343315;
}

double f(double x, double y, double z, double t, double a) {
        double r343316 = y;
        double r343317 = -2.9481876431266308e-46;
        bool r343318 = r343316 <= r343317;
        double r343319 = x;
        double r343320 = z;
        double r343321 = t;
        double r343322 = r343320 - r343321;
        double r343323 = a;
        double r343324 = r343322 / r343323;
        double r343325 = r343316 * r343324;
        double r343326 = r343319 - r343325;
        double r343327 = 4.635648024362553e-177;
        bool r343328 = r343316 <= r343327;
        double r343329 = 1.0;
        double r343330 = r343316 * r343322;
        double r343331 = r343323 / r343330;
        double r343332 = r343329 / r343331;
        double r343333 = r343319 - r343332;
        double r343334 = 2.802493622680903e-65;
        bool r343335 = r343316 <= r343334;
        double r343336 = r343316 / r343323;
        double r343337 = r343329 / r343322;
        double r343338 = r343336 / r343337;
        double r343339 = r343319 - r343338;
        double r343340 = r343335 ? r343339 : r343326;
        double r343341 = r343328 ? r343333 : r343340;
        double r343342 = r343318 ? r343326 : r343341;
        return r343342;
}

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.0
Target0.7
Herbie1.0
\[\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 < -2.9481876431266308e-46 or 2.802493622680903e-65 < y

    1. Initial program 11.9

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

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

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

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

    if -2.9481876431266308e-46 < y < 4.635648024362553e-177

    1. Initial program 0.5

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

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

    if 4.635648024362553e-177 < y < 2.802493622680903e-65

    1. Initial program 0.4

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.9481876431266308 \cdot 10^{-46}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \le 4.63564802436255314 \cdot 10^{-177}:\\ \;\;\;\;x - \frac{1}{\frac{a}{y \cdot \left(z - t\right)}}\\ \mathbf{elif}\;y \le 2.802493622680903 \cdot 10^{-65}:\\ \;\;\;\;x - \frac{\frac{y}{a}}{\frac{1}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020018 
(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)))