Average Error: 1.5 → 1.3
Time: 5.3s
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 r568933 = x;
        double r568934 = y;
        double r568935 = z;
        double r568936 = t;
        double r568937 = r568935 - r568936;
        double r568938 = a;
        double r568939 = r568938 - r568936;
        double r568940 = r568937 / r568939;
        double r568941 = r568934 * r568940;
        double r568942 = r568933 + r568941;
        return r568942;
}

double f(double x, double y, double z, double t, double a) {
        double r568943 = z;
        double r568944 = 3.8481634593943317e+185;
        bool r568945 = r568943 <= r568944;
        double r568946 = x;
        double r568947 = 1.0;
        double r568948 = y;
        double r568949 = a;
        double r568950 = t;
        double r568951 = r568949 - r568950;
        double r568952 = r568943 - r568950;
        double r568953 = r568951 / r568952;
        double r568954 = r568948 / r568953;
        double r568955 = r568947 * r568954;
        double r568956 = r568946 + r568955;
        double r568957 = r568948 / r568951;
        double r568958 = sqrt(r568947);
        double r568959 = r568947 / r568952;
        double r568960 = r568958 / r568959;
        double r568961 = r568957 * r568960;
        double r568962 = r568946 + r568961;
        double r568963 = r568945 ? r568956 : r568962;
        return r568963;
}

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)))))