Average Error: 6.1 → 0.5
Time: 4.1s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -6.59417047227896231 \cdot 10^{254}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 5.35794824374080815 \cdot 10^{166}:\\ \;\;\;\;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 -6.59417047227896231 \cdot 10^{254}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\

\mathbf{elif}\;y \cdot \left(z - t\right) \le 5.35794824374080815 \cdot 10^{166}:\\
\;\;\;\;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 r296546 = x;
        double r296547 = y;
        double r296548 = z;
        double r296549 = t;
        double r296550 = r296548 - r296549;
        double r296551 = r296547 * r296550;
        double r296552 = a;
        double r296553 = r296551 / r296552;
        double r296554 = r296546 - r296553;
        return r296554;
}

double f(double x, double y, double z, double t, double a) {
        double r296555 = y;
        double r296556 = z;
        double r296557 = t;
        double r296558 = r296556 - r296557;
        double r296559 = r296555 * r296558;
        double r296560 = -6.594170472278962e+254;
        bool r296561 = r296559 <= r296560;
        double r296562 = x;
        double r296563 = a;
        double r296564 = r296563 / r296558;
        double r296565 = r296555 / r296564;
        double r296566 = r296562 - r296565;
        double r296567 = 5.357948243740808e+166;
        bool r296568 = r296559 <= r296567;
        double r296569 = r296559 / r296563;
        double r296570 = r296562 - r296569;
        double r296571 = r296555 / r296563;
        double r296572 = r296571 * r296558;
        double r296573 = r296562 - r296572;
        double r296574 = r296568 ? r296570 : r296573;
        double r296575 = r296561 ? r296566 : r296574;
        return r296575;
}

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.1
Target0.7
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;y \lt -1.07612662163899753 \cdot 10^{-10}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{z - t}}{y}}\\ \mathbf{elif}\;y \lt 2.8944268627920891 \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)) < -6.594170472278962e+254

    1. Initial program 41.8

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

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

    if -6.594170472278962e+254 < (* y (- z t)) < 5.357948243740808e+166

    1. Initial program 0.3

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

    if 5.357948243740808e+166 < (* y (- z t))

    1. Initial program 24.1

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -6.59417047227896231 \cdot 10^{254}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 5.35794824374080815 \cdot 10^{166}:\\ \;\;\;\;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 2020024 
(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.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)))