Average Error: 6.3 → 0.3
Time: 5.0s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -1.228545789561995196537384183128883239661 \cdot 10^{306} \lor \neg \left(y \cdot \left(z - t\right) \le 8.251338783818022735263242037079282321832 \cdot 10^{226}\right):\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot z + y \cdot \left(-t\right)}{a}\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \cdot \left(z - t\right) \le -1.228545789561995196537384183128883239661 \cdot 10^{306} \lor \neg \left(y \cdot \left(z - t\right) \le 8.251338783818022735263242037079282321832 \cdot 10^{226}\right):\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\

\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot z + y \cdot \left(-t\right)}{a}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r320310 = x;
        double r320311 = y;
        double r320312 = z;
        double r320313 = t;
        double r320314 = r320312 - r320313;
        double r320315 = r320311 * r320314;
        double r320316 = a;
        double r320317 = r320315 / r320316;
        double r320318 = r320310 - r320317;
        return r320318;
}

double f(double x, double y, double z, double t, double a) {
        double r320319 = y;
        double r320320 = z;
        double r320321 = t;
        double r320322 = r320320 - r320321;
        double r320323 = r320319 * r320322;
        double r320324 = -1.2285457895619952e+306;
        bool r320325 = r320323 <= r320324;
        double r320326 = 8.251338783818023e+226;
        bool r320327 = r320323 <= r320326;
        double r320328 = !r320327;
        bool r320329 = r320325 || r320328;
        double r320330 = x;
        double r320331 = a;
        double r320332 = r320322 / r320331;
        double r320333 = r320319 * r320332;
        double r320334 = r320330 - r320333;
        double r320335 = r320319 * r320320;
        double r320336 = -r320321;
        double r320337 = r320319 * r320336;
        double r320338 = r320335 + r320337;
        double r320339 = r320338 / r320331;
        double r320340 = r320330 - r320339;
        double r320341 = r320329 ? r320334 : r320340;
        return r320341;
}

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.6
Herbie0.3
\[\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 2 regimes
  2. if (* y (- z t)) < -1.2285457895619952e+306 or 8.251338783818023e+226 < (* y (- z t))

    1. Initial program 43.9

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

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

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

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

    if -1.2285457895619952e+306 < (* y (- z t)) < 8.251338783818023e+226

    1. Initial program 0.3

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

      \[\leadsto x - \frac{y \cdot \color{blue}{\left(z + \left(-t\right)\right)}}{a}\]
    4. Applied distribute-lft-in0.3

      \[\leadsto x - \frac{\color{blue}{y \cdot z + y \cdot \left(-t\right)}}{a}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -1.228545789561995196537384183128883239661 \cdot 10^{306} \lor \neg \left(y \cdot \left(z - t\right) \le 8.251338783818022735263242037079282321832 \cdot 10^{226}\right):\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot z + y \cdot \left(-t\right)}{a}\\ \end{array}\]

Reproduce

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