Average Error: 6.5 → 1.3
Time: 3.2s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.5745896431018994 \cdot 10^{66}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \le 1.8297702711364304 \cdot 10^{-148}:\\ \;\;\;\;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 \le -1.5745896431018994 \cdot 10^{66}:\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\

\mathbf{elif}\;y \le 1.8297702711364304 \cdot 10^{-148}:\\
\;\;\;\;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 r317650 = x;
        double r317651 = y;
        double r317652 = z;
        double r317653 = t;
        double r317654 = r317652 - r317653;
        double r317655 = r317651 * r317654;
        double r317656 = a;
        double r317657 = r317655 / r317656;
        double r317658 = r317650 - r317657;
        return r317658;
}

double f(double x, double y, double z, double t, double a) {
        double r317659 = y;
        double r317660 = -1.5745896431018994e+66;
        bool r317661 = r317659 <= r317660;
        double r317662 = x;
        double r317663 = z;
        double r317664 = t;
        double r317665 = r317663 - r317664;
        double r317666 = a;
        double r317667 = r317665 / r317666;
        double r317668 = r317659 * r317667;
        double r317669 = r317662 - r317668;
        double r317670 = 1.8297702711364304e-148;
        bool r317671 = r317659 <= r317670;
        double r317672 = 1.0;
        double r317673 = r317659 * r317665;
        double r317674 = r317666 / r317673;
        double r317675 = r317672 / r317674;
        double r317676 = r317662 - r317675;
        double r317677 = r317666 / r317665;
        double r317678 = r317659 / r317677;
        double r317679 = r317662 - r317678;
        double r317680 = r317671 ? r317676 : r317679;
        double r317681 = r317661 ? r317669 : r317680;
        return r317681;
}

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.5
Target0.7
Herbie1.3
\[\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 < -1.5745896431018994e+66

    1. Initial program 19.0

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

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

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

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

    if -1.5745896431018994e+66 < y < 1.8297702711364304e-148

    1. Initial program 0.7

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

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

    if 1.8297702711364304e-148 < y

    1. Initial program 10.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.5745896431018994 \cdot 10^{66}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \le 1.8297702711364304 \cdot 10^{-148}:\\ \;\;\;\;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 2020083 
(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)))