Average Error: 1.3 → 1.4
Time: 14.8s
Precision: 64
\[x + y \cdot \frac{z - t}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le 1.144579354597698470869525383015031043462 \cdot 10^{-177} \lor \neg \left(y \le 6.273265383924108098562083329295224955425 \cdot 10^{-85}\right):\\ \;\;\;\;x + \frac{1}{\frac{a - t}{z - t}} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a - t} \cdot \left(-t\right) + \left(x + \frac{y \cdot z}{a - t}\right)\\ \end{array}\]
x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
\mathbf{if}\;y \le 1.144579354597698470869525383015031043462 \cdot 10^{-177} \lor \neg \left(y \le 6.273265383924108098562083329295224955425 \cdot 10^{-85}\right):\\
\;\;\;\;x + \frac{1}{\frac{a - t}{z - t}} \cdot y\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r498757 = x;
        double r498758 = y;
        double r498759 = z;
        double r498760 = t;
        double r498761 = r498759 - r498760;
        double r498762 = a;
        double r498763 = r498762 - r498760;
        double r498764 = r498761 / r498763;
        double r498765 = r498758 * r498764;
        double r498766 = r498757 + r498765;
        return r498766;
}

double f(double x, double y, double z, double t, double a) {
        double r498767 = y;
        double r498768 = 1.1445793545976985e-177;
        bool r498769 = r498767 <= r498768;
        double r498770 = 6.273265383924108e-85;
        bool r498771 = r498767 <= r498770;
        double r498772 = !r498771;
        bool r498773 = r498769 || r498772;
        double r498774 = x;
        double r498775 = 1.0;
        double r498776 = a;
        double r498777 = t;
        double r498778 = r498776 - r498777;
        double r498779 = z;
        double r498780 = r498779 - r498777;
        double r498781 = r498778 / r498780;
        double r498782 = r498775 / r498781;
        double r498783 = r498782 * r498767;
        double r498784 = r498774 + r498783;
        double r498785 = r498767 / r498778;
        double r498786 = -r498777;
        double r498787 = r498785 * r498786;
        double r498788 = r498767 * r498779;
        double r498789 = r498788 / r498778;
        double r498790 = r498774 + r498789;
        double r498791 = r498787 + r498790;
        double r498792 = r498773 ? r498784 : r498791;
        return r498792;
}

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.3
Target0.4
Herbie1.4
\[\begin{array}{l} \mathbf{if}\;y \lt -8.508084860551241069024247453646278348229 \cdot 10^{-17}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y \lt 2.894426862792089097262541964056085749132 \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 2 regimes
  2. if y < 1.1445793545976985e-177 or 6.273265383924108e-85 < y

    1. Initial program 1.2

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

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

    if 1.1445793545976985e-177 < y < 6.273265383924108e-85

    1. Initial program 3.0

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

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

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

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

      \[\leadsto x + \color{blue}{\frac{y}{a - t}} \cdot \left(z - t\right)\]
    8. Using strategy rm
    9. Applied sub-neg4.8

      \[\leadsto x + \frac{y}{a - t} \cdot \color{blue}{\left(z + \left(-t\right)\right)}\]
    10. Applied distribute-lft-in4.8

      \[\leadsto x + \color{blue}{\left(\frac{y}{a - t} \cdot z + \frac{y}{a - t} \cdot \left(-t\right)\right)}\]
    11. Applied associate-+r+4.8

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

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

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

Reproduce

herbie shell --seed 2019179 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"

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

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