Average Error: 5.9 → 0.8
Time: 17.6s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(z - t\right) \cdot y}{a} \le -3.44036116890877 \cdot 10^{+238}:\\ \;\;\;\;x - \frac{z - t}{\frac{a}{y}}\\ \mathbf{elif}\;\frac{\left(z - t\right) \cdot y}{a} \le 6.991329072900224 \cdot 10^{+283}:\\ \;\;\;\;x - \frac{\left(z - t\right) \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{z - t}{\frac{a}{y}}\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;\frac{\left(z - t\right) \cdot y}{a} \le -3.44036116890877 \cdot 10^{+238}:\\
\;\;\;\;x - \frac{z - t}{\frac{a}{y}}\\

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

\mathbf{else}:\\
\;\;\;\;x - \frac{z - t}{\frac{a}{y}}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r17405642 = x;
        double r17405643 = y;
        double r17405644 = z;
        double r17405645 = t;
        double r17405646 = r17405644 - r17405645;
        double r17405647 = r17405643 * r17405646;
        double r17405648 = a;
        double r17405649 = r17405647 / r17405648;
        double r17405650 = r17405642 - r17405649;
        return r17405650;
}

double f(double x, double y, double z, double t, double a) {
        double r17405651 = z;
        double r17405652 = t;
        double r17405653 = r17405651 - r17405652;
        double r17405654 = y;
        double r17405655 = r17405653 * r17405654;
        double r17405656 = a;
        double r17405657 = r17405655 / r17405656;
        double r17405658 = -3.44036116890877e+238;
        bool r17405659 = r17405657 <= r17405658;
        double r17405660 = x;
        double r17405661 = r17405656 / r17405654;
        double r17405662 = r17405653 / r17405661;
        double r17405663 = r17405660 - r17405662;
        double r17405664 = 6.991329072900224e+283;
        bool r17405665 = r17405657 <= r17405664;
        double r17405666 = r17405660 - r17405657;
        double r17405667 = r17405665 ? r17405666 : r17405663;
        double r17405668 = r17405659 ? r17405663 : r17405667;
        return r17405668;
}

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

Original5.9
Target0.7
Herbie0.8
\[\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 (- z t)) a) < -3.44036116890877e+238 or 6.991329072900224e+283 < (/ (* y (- z t)) a)

    1. Initial program 39.0

      \[x - \frac{y \cdot \left(z - t\right)}{a}\]
    2. Taylor expanded around 0 39.0

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

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

    if -3.44036116890877e+238 < (/ (* y (- z t)) a) < 6.991329072900224e+283

    1. Initial program 0.4

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

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

Reproduce

herbie shell --seed 2019162 
(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)))