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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r17558494 = x;
        double r17558495 = y;
        double r17558496 = z;
        double r17558497 = t;
        double r17558498 = r17558496 - r17558497;
        double r17558499 = r17558495 * r17558498;
        double r17558500 = a;
        double r17558501 = r17558499 / r17558500;
        double r17558502 = r17558494 - r17558501;
        return r17558502;
}

double f(double x, double y, double z, double t, double a) {
        double r17558503 = y;
        double r17558504 = -4.2928675080966004e+72;
        bool r17558505 = r17558503 <= r17558504;
        double r17558506 = x;
        double r17558507 = z;
        double r17558508 = a;
        double r17558509 = r17558507 / r17558508;
        double r17558510 = t;
        double r17558511 = r17558510 / r17558508;
        double r17558512 = r17558509 - r17558511;
        double r17558513 = r17558512 * r17558503;
        double r17558514 = r17558506 - r17558513;
        double r17558515 = 6.3044904655620086e-114;
        bool r17558516 = r17558503 <= r17558515;
        double r17558517 = r17558507 - r17558510;
        double r17558518 = r17558503 * r17558517;
        double r17558519 = r17558518 / r17558508;
        double r17558520 = r17558506 - r17558519;
        double r17558521 = r17558516 ? r17558520 : r17558514;
        double r17558522 = r17558505 ? r17558514 : r17558521;
        return r17558522;
}

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}:\\ \;\;\;\;x - \left(\frac{z}{a} - \frac{t}{a}\right) \cdot y\\ \mathbf{elif}\;y \le 6.3044904655620086 \cdot 10^{-114}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \left(\frac{z}{a} - \frac{t}{a}\right) \cdot y\\ \end{array}\]

Reproduce

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

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