Average Error: 6.4 → 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 -2.689959535719968 \cdot 10^{288} \lor \neg \left(y \cdot \left(z - t\right) \le 2.86112409662272748 \cdot 10^{191}\right):\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot \left(z - 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 -2.689959535719968 \cdot 10^{288} \lor \neg \left(y \cdot \left(z - t\right) \le 2.86112409662272748 \cdot 10^{191}\right):\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r341438 = x;
        double r341439 = y;
        double r341440 = z;
        double r341441 = t;
        double r341442 = r341440 - r341441;
        double r341443 = r341439 * r341442;
        double r341444 = a;
        double r341445 = r341443 / r341444;
        double r341446 = r341438 - r341445;
        return r341446;
}

double f(double x, double y, double z, double t, double a) {
        double r341447 = y;
        double r341448 = z;
        double r341449 = t;
        double r341450 = r341448 - r341449;
        double r341451 = r341447 * r341450;
        double r341452 = -2.689959535719968e+288;
        bool r341453 = r341451 <= r341452;
        double r341454 = 2.8611240966227275e+191;
        bool r341455 = r341451 <= r341454;
        double r341456 = !r341455;
        bool r341457 = r341453 || r341456;
        double r341458 = x;
        double r341459 = a;
        double r341460 = r341450 / r341459;
        double r341461 = r341447 * r341460;
        double r341462 = r341458 - r341461;
        double r341463 = r341451 / r341459;
        double r341464 = r341458 - r341463;
        double r341465 = r341457 ? r341462 : r341464;
        return r341465;
}

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.4
Target0.8
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 2 regimes
  2. if (* y (- z t)) < -2.689959535719968e+288 or 2.8611240966227275e+191 < (* y (- z t))

    1. Initial program 36.9

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

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

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

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

    if -2.689959535719968e+288 < (* y (- z t)) < 2.8611240966227275e+191

    1. Initial program 0.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -2.689959535719968 \cdot 10^{288} \lor \neg \left(y \cdot \left(z - t\right) \le 2.86112409662272748 \cdot 10^{191}\right):\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020081 +o rules:numerics
(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)))