Average Error: 6.0 → 1.3
Time: 21.8s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.2928675080966004 \cdot 10^{+72}:\\ \;\;\;\;\left(\frac{z}{a} - \frac{t}{a}\right) \cdot y + x\\ \mathbf{elif}\;y \le 6.3044904655620086 \cdot 10^{-114}:\\ \;\;\;\;\frac{y \cdot \left(z - t\right)}{a} + x\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{z}{a} - \frac{t}{a}\right) \cdot y + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \le -4.2928675080966004 \cdot 10^{+72}:\\
\;\;\;\;\left(\frac{z}{a} - \frac{t}{a}\right) \cdot y + x\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r14761159 = x;
        double r14761160 = y;
        double r14761161 = z;
        double r14761162 = t;
        double r14761163 = r14761161 - r14761162;
        double r14761164 = r14761160 * r14761163;
        double r14761165 = a;
        double r14761166 = r14761164 / r14761165;
        double r14761167 = r14761159 + r14761166;
        return r14761167;
}

double f(double x, double y, double z, double t, double a) {
        double r14761168 = y;
        double r14761169 = -4.2928675080966004e+72;
        bool r14761170 = r14761168 <= r14761169;
        double r14761171 = z;
        double r14761172 = a;
        double r14761173 = r14761171 / r14761172;
        double r14761174 = t;
        double r14761175 = r14761174 / r14761172;
        double r14761176 = r14761173 - r14761175;
        double r14761177 = r14761176 * r14761168;
        double r14761178 = x;
        double r14761179 = r14761177 + r14761178;
        double r14761180 = 6.3044904655620086e-114;
        bool r14761181 = r14761168 <= r14761180;
        double r14761182 = r14761171 - r14761174;
        double r14761183 = r14761168 * r14761182;
        double r14761184 = r14761183 / r14761172;
        double r14761185 = r14761184 + r14761178;
        double r14761186 = r14761181 ? r14761185 : r14761179;
        double r14761187 = r14761170 ? r14761179 : r14761186;
        return r14761187;
}

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.0
Target0.7
Herbie1.3
\[\begin{array}{l} \mathbf{if}\;y \lt -1.0761266216389975 \cdot 10^{-10}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a}{z - t}}{y}}\\ \mathbf{elif}\;y \lt 2.894426862792089 \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 < -4.2928675080966004e+72 or 6.3044904655620086e-114 < y

    1. Initial program 12.5

      \[x + \frac{y \cdot \left(z - t\right)}{a}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt13.0

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

      \[\leadsto x + \color{blue}{\frac{y}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z - t}{\sqrt[3]{a}}}\]
    5. Taylor expanded around 0 12.5

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

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

    if -4.2928675080966004e+72 < y < 6.3044904655620086e-114

    1. Initial program 1.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -4.2928675080966004 \cdot 10^{+72}:\\ \;\;\;\;\left(\frac{z}{a} - \frac{t}{a}\right) \cdot y + x\\ \mathbf{elif}\;y \le 6.3044904655620086 \cdot 10^{-114}:\\ \;\;\;\;\frac{y \cdot \left(z - t\right)}{a} + x\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{z}{a} - \frac{t}{a}\right) \cdot y + x\\ \end{array}\]

Reproduce

herbie shell --seed 2019168 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"

  :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)))