Average Error: 5.9 → 1.2
Time: 8.9s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.39950285805274381 \cdot 10^{104}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;a \le 3.75740059193433464 \cdot 10^{65}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \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}\;a \le -1.39950285805274381 \cdot 10^{104}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r308420 = x;
        double r308421 = y;
        double r308422 = z;
        double r308423 = t;
        double r308424 = r308422 - r308423;
        double r308425 = r308421 * r308424;
        double r308426 = a;
        double r308427 = r308425 / r308426;
        double r308428 = r308420 - r308427;
        return r308428;
}

double f(double x, double y, double z, double t, double a) {
        double r308429 = a;
        double r308430 = -1.3995028580527438e+104;
        bool r308431 = r308429 <= r308430;
        double r308432 = x;
        double r308433 = y;
        double r308434 = z;
        double r308435 = t;
        double r308436 = r308434 - r308435;
        double r308437 = r308429 / r308436;
        double r308438 = r308433 / r308437;
        double r308439 = r308432 - r308438;
        double r308440 = 3.7574005919343346e+65;
        bool r308441 = r308429 <= r308440;
        double r308442 = r308433 * r308436;
        double r308443 = r308442 / r308429;
        double r308444 = r308432 - r308443;
        double r308445 = r308436 / r308429;
        double r308446 = r308433 * r308445;
        double r308447 = r308432 - r308446;
        double r308448 = r308441 ? r308444 : r308447;
        double r308449 = r308431 ? r308439 : r308448;
        return r308449;
}

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
Herbie1.2
\[\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 a < -1.3995028580527438e+104

    1. Initial program 12.4

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

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

    if -1.3995028580527438e+104 < a < 3.7574005919343346e+65

    1. Initial program 1.6

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

    if 3.7574005919343346e+65 < a

    1. Initial program 10.0

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.39950285805274381 \cdot 10^{104}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;a \le 3.75740059193433464 \cdot 10^{65}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \end{array}\]

Reproduce

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