Average Error: 6.4 → 0.9
Time: 4.1s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.032251365798300526515280731070858077535 \cdot 10^{-78} \lor \neg \left(y \le 5.362866936719222556376208324779559010882 \cdot 10^{-26}\right):\\ \;\;\;\;y \cdot \frac{t - z}{a} + x\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\left(t - z\right) \cdot y}{a}\right)}^{1} + x\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \le -1.032251365798300526515280731070858077535 \cdot 10^{-78} \lor \neg \left(y \le 5.362866936719222556376208324779559010882 \cdot 10^{-26}\right):\\
\;\;\;\;y \cdot \frac{t - z}{a} + x\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r252526 = x;
        double r252527 = y;
        double r252528 = z;
        double r252529 = t;
        double r252530 = r252528 - r252529;
        double r252531 = r252527 * r252530;
        double r252532 = a;
        double r252533 = r252531 / r252532;
        double r252534 = r252526 - r252533;
        return r252534;
}

double f(double x, double y, double z, double t, double a) {
        double r252535 = y;
        double r252536 = -1.0322513657983005e-78;
        bool r252537 = r252535 <= r252536;
        double r252538 = 5.362866936719223e-26;
        bool r252539 = r252535 <= r252538;
        double r252540 = !r252539;
        bool r252541 = r252537 || r252540;
        double r252542 = t;
        double r252543 = z;
        double r252544 = r252542 - r252543;
        double r252545 = a;
        double r252546 = r252544 / r252545;
        double r252547 = r252535 * r252546;
        double r252548 = x;
        double r252549 = r252547 + r252548;
        double r252550 = r252544 * r252535;
        double r252551 = r252550 / r252545;
        double r252552 = 1.0;
        double r252553 = pow(r252551, r252552);
        double r252554 = r252553 + r252548;
        double r252555 = r252541 ? r252549 : r252554;
        return r252555;
}

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.7
Herbie0.9
\[\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 < -1.0322513657983005e-78 or 5.362866936719223e-26 < y

    1. Initial program 13.0

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{a}, t - z, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef2.9

      \[\leadsto \color{blue}{\frac{y}{a} \cdot \left(t - z\right) + x}\]
    5. Using strategy rm
    6. Applied div-inv3.0

      \[\leadsto \color{blue}{\left(y \cdot \frac{1}{a}\right)} \cdot \left(t - z\right) + x\]
    7. Applied associate-*l*1.4

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

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

    if -1.0322513657983005e-78 < y < 5.362866936719223e-26

    1. Initial program 0.5

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{a}, t - z, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef2.4

      \[\leadsto \color{blue}{\frac{y}{a} \cdot \left(t - z\right) + x}\]
    5. Using strategy rm
    6. Applied pow12.4

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

      \[\leadsto \color{blue}{{\left(\frac{y}{a}\right)}^{1}} \cdot {\left(t - z\right)}^{1} + x\]
    8. Applied pow-prod-down2.4

      \[\leadsto \color{blue}{{\left(\frac{y}{a} \cdot \left(t - z\right)\right)}^{1}} + x\]
    9. Simplified0.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.032251365798300526515280731070858077535 \cdot 10^{-78} \lor \neg \left(y \le 5.362866936719222556376208324779559010882 \cdot 10^{-26}\right):\\ \;\;\;\;y \cdot \frac{t - z}{a} + x\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\left(t - z\right) \cdot y}{a}\right)}^{1} + x\\ \end{array}\]

Reproduce

herbie shell --seed 2020002 +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)))