Average Error: 6.2 → 2.5
Time: 8.6s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;z \le -5.3249082459376733 \cdot 10^{-158} \lor \neg \left(z \le 6.9390753974297484 \cdot 10^{-149}\right):\\ \;\;\;\;x + \frac{y}{a} \cdot \left(z - t\right)\\ \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}\;z \le -5.3249082459376733 \cdot 10^{-158} \lor \neg \left(z \le 6.9390753974297484 \cdot 10^{-149}\right):\\
\;\;\;\;x + \frac{y}{a} \cdot \left(z - t\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r457585 = x;
        double r457586 = y;
        double r457587 = z;
        double r457588 = t;
        double r457589 = r457587 - r457588;
        double r457590 = r457586 * r457589;
        double r457591 = a;
        double r457592 = r457590 / r457591;
        double r457593 = r457585 + r457592;
        return r457593;
}

double f(double x, double y, double z, double t, double a) {
        double r457594 = z;
        double r457595 = -5.324908245937673e-158;
        bool r457596 = r457594 <= r457595;
        double r457597 = 6.939075397429748e-149;
        bool r457598 = r457594 <= r457597;
        double r457599 = !r457598;
        bool r457600 = r457596 || r457599;
        double r457601 = x;
        double r457602 = y;
        double r457603 = a;
        double r457604 = r457602 / r457603;
        double r457605 = t;
        double r457606 = r457594 - r457605;
        double r457607 = r457604 * r457606;
        double r457608 = r457601 + r457607;
        double r457609 = r457606 / r457603;
        double r457610 = r457602 * r457609;
        double r457611 = r457601 + r457610;
        double r457612 = r457600 ? r457608 : r457611;
        return r457612;
}

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.2
Target0.7
Herbie2.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 z < -5.324908245937673e-158 or 6.939075397429748e-149 < z

    1. Initial program 6.9

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

      \[\leadsto x + \color{blue}{\frac{y}{\frac{a}{z - t}}}\]
    4. Using strategy rm
    5. Applied associate-/r/2.1

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

    if -5.324908245937673e-158 < z < 6.939075397429748e-149

    1. Initial program 4.2

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

      \[\leadsto x + \color{blue}{\frac{y}{\frac{a}{z - t}}}\]
    4. Using strategy rm
    5. Applied associate-/r/3.5

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

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

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

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

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

Reproduce

herbie shell --seed 2020047 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
  :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)))