Average Error: 6.7 → 0.3
Time: 14.1s
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} \lor \neg \left(y \cdot \left(z - t\right) \le 1.011752889555668005202159688789175597537 \cdot 10^{256}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \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} \lor \neg \left(y \cdot \left(z - t\right) \le 1.011752889555668005202159688789175597537 \cdot 10^{256}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r874092 = x;
        double r874093 = y;
        double r874094 = z;
        double r874095 = t;
        double r874096 = r874094 - r874095;
        double r874097 = r874093 * r874096;
        double r874098 = a;
        double r874099 = r874097 / r874098;
        double r874100 = r874092 + r874099;
        return r874100;
}

double f(double x, double y, double z, double t, double a) {
        double r874101 = y;
        double r874102 = z;
        double r874103 = t;
        double r874104 = r874102 - r874103;
        double r874105 = r874101 * r874104;
        double r874106 = -1.6255848839737217e+255;
        bool r874107 = r874105 <= r874106;
        double r874108 = 1.011752889555668e+256;
        bool r874109 = r874105 <= r874108;
        double r874110 = !r874109;
        bool r874111 = r874107 || r874110;
        double r874112 = x;
        double r874113 = a;
        double r874114 = r874104 / r874113;
        double r874115 = r874101 * r874114;
        double r874116 = r874112 + r874115;
        double r874117 = r874105 / r874113;
        double r874118 = r874112 + r874117;
        double r874119 = r874111 ? r874116 : r874118;
        return r874119;
}

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.3
\[\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 2 regimes
  2. if (* y (- z t)) < -1.6255848839737217e+255 or 1.011752889555668e+256 < (* y (- z t))

    1. Initial program 44.0

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

      \[\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)) < 1.011752889555668e+256

    1. Initial program 0.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -1.625584883973721715996929220851638670999 \cdot 10^{255} \lor \neg \left(y \cdot \left(z - t\right) \le 1.011752889555668005202159688789175597537 \cdot 10^{256}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019209 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
  :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)))