Average Error: 5.9 → 0.9
Time: 3.6s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -1.1473918177297942 \cdot 10^{219}:\\ \;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 6.43849552264531777 \cdot 10^{124}:\\ \;\;\;\;x - \frac{1}{\frac{a}{y \cdot \left(z - t\right)}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \cdot \left(z - t\right) \le -1.1473918177297942 \cdot 10^{219}:\\
\;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r328110 = x;
        double r328111 = y;
        double r328112 = z;
        double r328113 = t;
        double r328114 = r328112 - r328113;
        double r328115 = r328111 * r328114;
        double r328116 = a;
        double r328117 = r328115 / r328116;
        double r328118 = r328110 - r328117;
        return r328118;
}

double f(double x, double y, double z, double t, double a) {
        double r328119 = y;
        double r328120 = z;
        double r328121 = t;
        double r328122 = r328120 - r328121;
        double r328123 = r328119 * r328122;
        double r328124 = -1.1473918177297942e+219;
        bool r328125 = r328123 <= r328124;
        double r328126 = x;
        double r328127 = a;
        double r328128 = r328119 / r328127;
        double r328129 = r328128 * r328122;
        double r328130 = r328126 - r328129;
        double r328131 = 6.438495522645318e+124;
        bool r328132 = r328123 <= r328131;
        double r328133 = 1.0;
        double r328134 = r328127 / r328123;
        double r328135 = r328133 / r328134;
        double r328136 = r328126 - r328135;
        double r328137 = r328127 / r328122;
        double r328138 = r328119 / r328137;
        double r328139 = r328126 - r328138;
        double r328140 = r328132 ? r328136 : r328139;
        double r328141 = r328125 ? r328130 : r328140;
        return r328141;
}

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

Original5.9
Target0.7
Herbie0.9
\[\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)) < -1.1473918177297942e+219

    1. Initial program 30.3

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

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

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

    if -1.1473918177297942e+219 < (* y (- z t)) < 6.438495522645318e+124

    1. Initial program 0.5

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

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

    if 6.438495522645318e+124 < (* y (- z t))

    1. Initial program 17.6

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

      \[\leadsto x - \color{blue}{\frac{y}{\frac{a}{z - t}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -1.1473918177297942 \cdot 10^{219}:\\ \;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 6.43849552264531777 \cdot 10^{124}:\\ \;\;\;\;x - \frac{1}{\frac{a}{y \cdot \left(z - t\right)}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \end{array}\]

Reproduce

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