Average Error: 1.3 → 1.4
Time: 20.8s
Precision: 64
\[x + y \cdot \frac{z - t}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.214830660645499253157894524356128905789 \cdot 10^{-53}:\\ \;\;\;\;y \cdot \frac{z - t}{a - t} + x\\ \mathbf{elif}\;t \le 2.262416427079256376057820187996240271966 \cdot 10^{-38}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{a - t} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{a - t}{z - t}} + x\\ \end{array}\]
x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
\mathbf{if}\;t \le -1.214830660645499253157894524356128905789 \cdot 10^{-53}:\\
\;\;\;\;y \cdot \frac{z - t}{a - t} + x\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r27316685 = x;
        double r27316686 = y;
        double r27316687 = z;
        double r27316688 = t;
        double r27316689 = r27316687 - r27316688;
        double r27316690 = a;
        double r27316691 = r27316690 - r27316688;
        double r27316692 = r27316689 / r27316691;
        double r27316693 = r27316686 * r27316692;
        double r27316694 = r27316685 + r27316693;
        return r27316694;
}

double f(double x, double y, double z, double t, double a) {
        double r27316695 = t;
        double r27316696 = -1.2148306606454993e-53;
        bool r27316697 = r27316695 <= r27316696;
        double r27316698 = y;
        double r27316699 = z;
        double r27316700 = r27316699 - r27316695;
        double r27316701 = a;
        double r27316702 = r27316701 - r27316695;
        double r27316703 = r27316700 / r27316702;
        double r27316704 = r27316698 * r27316703;
        double r27316705 = x;
        double r27316706 = r27316704 + r27316705;
        double r27316707 = 2.2624164270792564e-38;
        bool r27316708 = r27316695 <= r27316707;
        double r27316709 = r27316700 * r27316698;
        double r27316710 = r27316709 / r27316702;
        double r27316711 = r27316710 + r27316705;
        double r27316712 = r27316702 / r27316700;
        double r27316713 = r27316698 / r27316712;
        double r27316714 = r27316713 + r27316705;
        double r27316715 = r27316708 ? r27316711 : r27316714;
        double r27316716 = r27316697 ? r27316706 : r27316715;
        return r27316716;
}

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.5
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 3 regimes
  2. if t < -1.2148306606454993e-53

    1. Initial program 0.1

      \[x + y \cdot \frac{z - t}{a - t}\]

    if -1.2148306606454993e-53 < t < 2.2624164270792564e-38

    1. Initial program 3.1

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

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

    if 2.2624164270792564e-38 < t

    1. Initial program 0.1

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

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(z - t\right)}{a - t}}\]
    4. Using strategy rm
    5. Applied associate-/l*0.1

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

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

Reproduce

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