Average Error: 6.4 → 0.5
Time: 4.5s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -2.689959535719968 \cdot 10^{288}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 3.12395947034459992 \cdot 10^{186}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \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 -2.689959535719968 \cdot 10^{288}:\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r293506 = x;
        double r293507 = y;
        double r293508 = z;
        double r293509 = t;
        double r293510 = r293508 - r293509;
        double r293511 = r293507 * r293510;
        double r293512 = a;
        double r293513 = r293511 / r293512;
        double r293514 = r293506 - r293513;
        return r293514;
}

double f(double x, double y, double z, double t, double a) {
        double r293515 = y;
        double r293516 = z;
        double r293517 = t;
        double r293518 = r293516 - r293517;
        double r293519 = r293515 * r293518;
        double r293520 = -2.689959535719968e+288;
        bool r293521 = r293519 <= r293520;
        double r293522 = x;
        double r293523 = a;
        double r293524 = r293518 / r293523;
        double r293525 = r293515 * r293524;
        double r293526 = r293522 - r293525;
        double r293527 = 3.1239594703446e+186;
        bool r293528 = r293519 <= r293527;
        double r293529 = r293519 / r293523;
        double r293530 = r293522 - r293529;
        double r293531 = r293523 / r293518;
        double r293532 = r293515 / r293531;
        double r293533 = r293522 - r293532;
        double r293534 = r293528 ? r293530 : r293533;
        double r293535 = r293521 ? r293526 : r293534;
        return r293535;
}

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.8
Herbie0.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 3 regimes
  2. if (* y (- z t)) < -2.689959535719968e+288

    1. Initial program 54.0

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

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

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

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

    if -2.689959535719968e+288 < (* y (- z t)) < 3.1239594703446e+186

    1. Initial program 0.5

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

    if 3.1239594703446e+186 < (* y (- z t))

    1. Initial program 26.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -2.689959535719968 \cdot 10^{288}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 3.12395947034459992 \cdot 10^{186}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \end{array}\]

Reproduce

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