Average Error: 17.0 → 7.9
Time: 16.2s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -9.441885900140899165846736068361029145014 \cdot 10^{140}:\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \mathbf{elif}\;t \le 6.772624804214054808988189513933475870735 \cdot 10^{-48}:\\ \;\;\;\;x + \left(y - \frac{z - t}{\frac{a - t}{y}}\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(1 - \left(z - t\right) \cdot \frac{1}{a - t}\right)\\ \end{array}\]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;t \le -9.441885900140899165846736068361029145014 \cdot 10^{140}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r418906 = x;
        double r418907 = y;
        double r418908 = r418906 + r418907;
        double r418909 = z;
        double r418910 = t;
        double r418911 = r418909 - r418910;
        double r418912 = r418911 * r418907;
        double r418913 = a;
        double r418914 = r418913 - r418910;
        double r418915 = r418912 / r418914;
        double r418916 = r418908 - r418915;
        return r418916;
}

double f(double x, double y, double z, double t, double a) {
        double r418917 = t;
        double r418918 = -9.4418859001409e+140;
        bool r418919 = r418917 <= r418918;
        double r418920 = x;
        double r418921 = y;
        double r418922 = z;
        double r418923 = r418922 / r418917;
        double r418924 = r418921 * r418923;
        double r418925 = r418920 + r418924;
        double r418926 = 6.772624804214055e-48;
        bool r418927 = r418917 <= r418926;
        double r418928 = r418922 - r418917;
        double r418929 = a;
        double r418930 = r418929 - r418917;
        double r418931 = r418930 / r418921;
        double r418932 = r418928 / r418931;
        double r418933 = r418921 - r418932;
        double r418934 = r418920 + r418933;
        double r418935 = 1.0;
        double r418936 = r418935 / r418930;
        double r418937 = r418928 * r418936;
        double r418938 = r418935 - r418937;
        double r418939 = r418921 * r418938;
        double r418940 = r418920 + r418939;
        double r418941 = r418927 ? r418934 : r418940;
        double r418942 = r418919 ? r418925 : r418941;
        return r418942;
}

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

Original17.0
Target8.3
Herbie7.9
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt -1.366497088939072697550672266103566343531 \cdot 10^{-7}:\\ \;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\ \mathbf{elif}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt 1.475429344457723334351036314450840066235 \cdot 10^{-239}:\\ \;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if t < -9.4418859001409e+140

    1. Initial program 32.6

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Using strategy rm
    3. Applied associate-/l*24.1

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

      \[\leadsto \color{blue}{x + \left(y - \frac{z - t}{\frac{a - t}{y}}\right)}\]
    6. Using strategy rm
    7. Applied associate-/r/12.6

      \[\leadsto x + \left(y - \color{blue}{\frac{z - t}{a - t} \cdot y}\right)\]
    8. Applied *-un-lft-identity12.6

      \[\leadsto x + \left(\color{blue}{1 \cdot y} - \frac{z - t}{a - t} \cdot y\right)\]
    9. Applied distribute-rgt-out--12.5

      \[\leadsto x + \color{blue}{y \cdot \left(1 - \frac{z - t}{a - t}\right)}\]
    10. Taylor expanded around inf 11.3

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

    if -9.4418859001409e+140 < t < 6.772624804214055e-48

    1. Initial program 8.8

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Using strategy rm
    3. Applied associate-/l*6.3

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

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

    if 6.772624804214055e-48 < t

    1. Initial program 24.1

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
    2. Using strategy rm
    3. Applied associate-/l*17.1

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

      \[\leadsto \color{blue}{x + \left(y - \frac{z - t}{\frac{a - t}{y}}\right)}\]
    6. Using strategy rm
    7. Applied associate-/r/10.1

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

      \[\leadsto x + \left(\color{blue}{1 \cdot y} - \frac{z - t}{a - t} \cdot y\right)\]
    9. Applied distribute-rgt-out--10.1

      \[\leadsto x + \color{blue}{y \cdot \left(1 - \frac{z - t}{a - t}\right)}\]
    10. Using strategy rm
    11. Applied div-inv11.1

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

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

Reproduce

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

  :herbie-target
  (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-7) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.47542934445772333e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y))))

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