Average Error: 1.2 → 0.4
Time: 5.5s
Precision: 64
\[x + y \cdot \frac{z - t}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -8.06916043366223524 \cdot 10^{-64}:\\ \;\;\;\;1 \cdot \frac{y}{\frac{a - t}{z - t}} + x\\ \mathbf{elif}\;y \le 5.4933827527075371 \cdot 10^{24}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a - t}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z - t}{a - t} + x\\ \end{array}\]
x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
\mathbf{if}\;y \le -8.06916043366223524 \cdot 10^{-64}:\\
\;\;\;\;1 \cdot \frac{y}{\frac{a - t}{z - t}} + x\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r543605 = x;
        double r543606 = y;
        double r543607 = z;
        double r543608 = t;
        double r543609 = r543607 - r543608;
        double r543610 = a;
        double r543611 = r543610 - r543608;
        double r543612 = r543609 / r543611;
        double r543613 = r543606 * r543612;
        double r543614 = r543605 + r543613;
        return r543614;
}

double f(double x, double y, double z, double t, double a) {
        double r543615 = y;
        double r543616 = -8.069160433662235e-64;
        bool r543617 = r543615 <= r543616;
        double r543618 = 1.0;
        double r543619 = a;
        double r543620 = t;
        double r543621 = r543619 - r543620;
        double r543622 = z;
        double r543623 = r543622 - r543620;
        double r543624 = r543621 / r543623;
        double r543625 = r543615 / r543624;
        double r543626 = r543618 * r543625;
        double r543627 = x;
        double r543628 = r543626 + r543627;
        double r543629 = 5.493382752707537e+24;
        bool r543630 = r543615 <= r543629;
        double r543631 = r543615 * r543623;
        double r543632 = r543631 / r543621;
        double r543633 = r543627 + r543632;
        double r543634 = r543623 / r543621;
        double r543635 = r543615 * r543634;
        double r543636 = r543635 + r543627;
        double r543637 = r543630 ? r543633 : r543636;
        double r543638 = r543617 ? r543628 : r543637;
        return r543638;
}

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

Original1.2
Target0.4
Herbie0.4
\[\begin{array}{l} \mathbf{if}\;y \lt -8.50808486055124107 \cdot 10^{-17}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y \lt 2.8944268627920891 \cdot 10^{-49}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if y < -8.069160433662235e-64

    1. Initial program 0.5

      \[x + y \cdot \frac{z - t}{a - t}\]
    2. Using strategy rm
    3. Applied +-commutative0.5

      \[\leadsto \color{blue}{y \cdot \frac{z - t}{a - t} + x}\]
    4. Using strategy rm
    5. Applied clear-num0.6

      \[\leadsto y \cdot \color{blue}{\frac{1}{\frac{a - t}{z - t}}} + x\]
    6. Using strategy rm
    7. Applied *-un-lft-identity0.6

      \[\leadsto \color{blue}{\left(1 \cdot y\right)} \cdot \frac{1}{\frac{a - t}{z - t}} + x\]
    8. Applied associate-*l*0.6

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

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

    if -8.069160433662235e-64 < y < 5.493382752707537e+24

    1. Initial program 1.9

      \[x + y \cdot \frac{z - t}{a - t}\]
    2. Using strategy rm
    3. Applied associate-*r/0.4

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

    if 5.493382752707537e+24 < y

    1. Initial program 0.4

      \[x + y \cdot \frac{z - t}{a - t}\]
    2. Using strategy rm
    3. Applied +-commutative0.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -8.06916043366223524 \cdot 10^{-64}:\\ \;\;\;\;1 \cdot \frac{y}{\frac{a - t}{z - t}} + x\\ \mathbf{elif}\;y \le 5.4933827527075371 \cdot 10^{24}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a - t}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z - t}{a - t} + x\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))

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