Average Error: 10.8 → 0.5
Time: 15.1s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.293463962714998493379525507428593936827 \cdot 10^{-60} \lor \neg \left(y \le 1.812839748984545334595059911175536357052 \cdot 10^{-103}\right):\\ \;\;\;\;x + \frac{y}{\frac{z - a}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{z - a}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{z - a}
\begin{array}{l}
\mathbf{if}\;y \le -4.293463962714998493379525507428593936827 \cdot 10^{-60} \lor \neg \left(y \le 1.812839748984545334595059911175536357052 \cdot 10^{-103}\right):\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z - t}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r306453 = x;
        double r306454 = y;
        double r306455 = z;
        double r306456 = t;
        double r306457 = r306455 - r306456;
        double r306458 = r306454 * r306457;
        double r306459 = a;
        double r306460 = r306455 - r306459;
        double r306461 = r306458 / r306460;
        double r306462 = r306453 + r306461;
        return r306462;
}

double f(double x, double y, double z, double t, double a) {
        double r306463 = y;
        double r306464 = -4.2934639627149985e-60;
        bool r306465 = r306463 <= r306464;
        double r306466 = 1.8128397489845453e-103;
        bool r306467 = r306463 <= r306466;
        double r306468 = !r306467;
        bool r306469 = r306465 || r306468;
        double r306470 = x;
        double r306471 = z;
        double r306472 = a;
        double r306473 = r306471 - r306472;
        double r306474 = t;
        double r306475 = r306471 - r306474;
        double r306476 = r306473 / r306475;
        double r306477 = r306463 / r306476;
        double r306478 = r306470 + r306477;
        double r306479 = r306463 * r306475;
        double r306480 = 1.0;
        double r306481 = r306480 / r306473;
        double r306482 = r306479 * r306481;
        double r306483 = r306470 + r306482;
        double r306484 = r306469 ? r306478 : r306483;
        return r306484;
}

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

Original10.8
Target1.2
Herbie0.5
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -4.2934639627149985e-60 or 1.8128397489845453e-103 < y

    1. Initial program 18.2

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

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

    if -4.2934639627149985e-60 < y < 1.8128397489845453e-103

    1. Initial program 0.5

      \[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
    2. Using strategy rm
    3. Applied div-inv0.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -4.293463962714998493379525507428593936827 \cdot 10^{-60} \lor \neg \left(y \le 1.812839748984545334595059911175536357052 \cdot 10^{-103}\right):\\ \;\;\;\;x + \frac{y}{\frac{z - a}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{z - a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019208 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
  :precision binary64

  :herbie-target
  (+ x (/ y (/ (- z a) (- z t))))

  (+ x (/ (* y (- z t)) (- z a))))