Average Error: 1.5 → 1.3
Time: 5.2s
Precision: 64
\[x + y \cdot \frac{z - t}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;z \le 3.848163459394331689137313253237119172793 \cdot 10^{185}:\\ \;\;\;\;x + 1 \cdot \frac{y}{\frac{a - t}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{a - t} \cdot \frac{\sqrt{1}}{\frac{1}{z - t}}\\ \end{array}\]
x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
\mathbf{if}\;z \le 3.848163459394331689137313253237119172793 \cdot 10^{185}:\\
\;\;\;\;x + 1 \cdot \frac{y}{\frac{a - t}{z - t}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r835574 = x;
        double r835575 = y;
        double r835576 = z;
        double r835577 = t;
        double r835578 = r835576 - r835577;
        double r835579 = a;
        double r835580 = r835579 - r835577;
        double r835581 = r835578 / r835580;
        double r835582 = r835575 * r835581;
        double r835583 = r835574 + r835582;
        return r835583;
}

double f(double x, double y, double z, double t, double a) {
        double r835584 = z;
        double r835585 = 3.8481634593943317e+185;
        bool r835586 = r835584 <= r835585;
        double r835587 = x;
        double r835588 = 1.0;
        double r835589 = y;
        double r835590 = a;
        double r835591 = t;
        double r835592 = r835590 - r835591;
        double r835593 = r835584 - r835591;
        double r835594 = r835592 / r835593;
        double r835595 = r835589 / r835594;
        double r835596 = r835588 * r835595;
        double r835597 = r835587 + r835596;
        double r835598 = r835589 / r835592;
        double r835599 = sqrt(r835588);
        double r835600 = r835588 / r835593;
        double r835601 = r835599 / r835600;
        double r835602 = r835598 * r835601;
        double r835603 = r835587 + r835602;
        double r835604 = r835586 ? r835597 : r835603;
        return r835604;
}

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.5
Target0.4
Herbie1.3
\[\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 z < 3.8481634593943317e+185

    1. Initial program 1.1

      \[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}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity1.2

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

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

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

    if 3.8481634593943317e+185 < z

    1. Initial program 5.1

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

      \[\leadsto x + y \cdot \color{blue}{\frac{1}{\frac{a - t}{z - t}}}\]
    4. Using strategy rm
    5. Applied div-inv5.2

      \[\leadsto x + y \cdot \frac{1}{\color{blue}{\left(a - t\right) \cdot \frac{1}{z - t}}}\]
    6. Applied add-sqr-sqrt5.2

      \[\leadsto x + y \cdot \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{\left(a - t\right) \cdot \frac{1}{z - t}}\]
    7. Applied times-frac5.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le 3.848163459394331689137313253237119172793 \cdot 10^{185}:\\ \;\;\;\;x + 1 \cdot \frac{y}{\frac{a - t}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{a - t} \cdot \frac{\sqrt{1}}{\frac{1}{z - t}}\\ \end{array}\]

Reproduce

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