Average Error: 6.3 → 1.4
Time: 7.3s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -4.9168923767645714 \cdot 10^{80}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 2.08730857278766648 \cdot 10^{115}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \cdot \left(z - t\right) \le -4.9168923767645714 \cdot 10^{80}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r368697 = x;
        double r368698 = y;
        double r368699 = z;
        double r368700 = t;
        double r368701 = r368699 - r368700;
        double r368702 = r368698 * r368701;
        double r368703 = a;
        double r368704 = r368702 / r368703;
        double r368705 = r368697 - r368704;
        return r368705;
}

double f(double x, double y, double z, double t, double a) {
        double r368706 = y;
        double r368707 = z;
        double r368708 = t;
        double r368709 = r368707 - r368708;
        double r368710 = r368706 * r368709;
        double r368711 = -4.916892376764571e+80;
        bool r368712 = r368710 <= r368711;
        double r368713 = x;
        double r368714 = a;
        double r368715 = r368714 / r368709;
        double r368716 = r368706 / r368715;
        double r368717 = r368713 - r368716;
        double r368718 = 2.0873085727876665e+115;
        bool r368719 = r368710 <= r368718;
        double r368720 = r368710 / r368714;
        double r368721 = r368713 - r368720;
        double r368722 = r368706 / r368714;
        double r368723 = r368722 * r368709;
        double r368724 = r368713 - r368723;
        double r368725 = r368719 ? r368721 : r368724;
        double r368726 = r368712 ? r368717 : r368725;
        return r368726;
}

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.7
Herbie1.4
\[\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 (- z t)) < -4.916892376764571e+80

    1. Initial program 14.6

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

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

    if -4.916892376764571e+80 < (* y (- z t)) < 2.0873085727876665e+115

    1. Initial program 0.5

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

    if 2.0873085727876665e+115 < (* y (- z t))

    1. Initial program 18.1

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -4.9168923767645714 \cdot 10^{80}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 2.08730857278766648 \cdot 10^{115}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\ \end{array}\]

Reproduce

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