Average Error: 6.7 → 0.4
Time: 13.4s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -1.625584883973721715996929220851638670999 \cdot 10^{255}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 2.143948490603520686127081681315653192418 \cdot 10^{204}:\\ \;\;\;\;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 -1.625584883973721715996929220851638670999 \cdot 10^{255}:\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\

\mathbf{elif}\;y \cdot \left(z - t\right) \le 2.143948490603520686127081681315653192418 \cdot 10^{204}:\\
\;\;\;\;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 r262817 = x;
        double r262818 = y;
        double r262819 = z;
        double r262820 = t;
        double r262821 = r262819 - r262820;
        double r262822 = r262818 * r262821;
        double r262823 = a;
        double r262824 = r262822 / r262823;
        double r262825 = r262817 - r262824;
        return r262825;
}

double f(double x, double y, double z, double t, double a) {
        double r262826 = y;
        double r262827 = z;
        double r262828 = t;
        double r262829 = r262827 - r262828;
        double r262830 = r262826 * r262829;
        double r262831 = -1.6255848839737217e+255;
        bool r262832 = r262830 <= r262831;
        double r262833 = x;
        double r262834 = a;
        double r262835 = r262829 / r262834;
        double r262836 = r262826 * r262835;
        double r262837 = r262833 - r262836;
        double r262838 = 2.1439484906035207e+204;
        bool r262839 = r262830 <= r262838;
        double r262840 = r262830 / r262834;
        double r262841 = r262833 - r262840;
        double r262842 = r262826 / r262834;
        double r262843 = r262842 * r262829;
        double r262844 = r262833 - r262843;
        double r262845 = r262839 ? r262841 : r262844;
        double r262846 = r262832 ? r262837 : r262845;
        return r262846;
}

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.7
Target0.7
Herbie0.4
\[\begin{array}{l} \mathbf{if}\;y \lt -1.07612662163899753216593153715602325729 \cdot 10^{-10}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{z - t}}{y}}\\ \mathbf{elif}\;y \lt 2.894426862792089097262541964056085749132 \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.6255848839737217e+255

    1. Initial program 43.6

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

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

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

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

    if -1.6255848839737217e+255 < (* y (- z t)) < 2.1439484906035207e+204

    1. Initial program 0.4

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

    if 2.1439484906035207e+204 < (* y (- z t))

    1. Initial program 31.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -1.625584883973721715996929220851638670999 \cdot 10^{255}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 2.143948490603520686127081681315653192418 \cdot 10^{204}:\\ \;\;\;\;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 2019209 
(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.07612662163899753e-10) (- x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2.8944268627920891e-49) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t))))))

  (- x (/ (* y (- z t)) a)))