Average Error: 16.4 → 8.9
Time: 12.6s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -4.072147695298824991622230320368106205265 \cdot 10^{-86} \lor \neg \left(a \le 3.076583953261557678467109322067364719153 \cdot 10^{-124}\right):\\ \;\;\;\;y + \left(x - y \cdot \frac{z - t}{a - t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \end{array}\]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -4.072147695298824991622230320368106205265 \cdot 10^{-86} \lor \neg \left(a \le 3.076583953261557678467109322067364719153 \cdot 10^{-124}\right):\\
\;\;\;\;y + \left(x - y \cdot \frac{z - t}{a - t}\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r431108 = x;
        double r431109 = y;
        double r431110 = r431108 + r431109;
        double r431111 = z;
        double r431112 = t;
        double r431113 = r431111 - r431112;
        double r431114 = r431113 * r431109;
        double r431115 = a;
        double r431116 = r431115 - r431112;
        double r431117 = r431114 / r431116;
        double r431118 = r431110 - r431117;
        return r431118;
}

double f(double x, double y, double z, double t, double a) {
        double r431119 = a;
        double r431120 = -4.072147695298825e-86;
        bool r431121 = r431119 <= r431120;
        double r431122 = 3.0765839532615577e-124;
        bool r431123 = r431119 <= r431122;
        double r431124 = !r431123;
        bool r431125 = r431121 || r431124;
        double r431126 = y;
        double r431127 = x;
        double r431128 = z;
        double r431129 = t;
        double r431130 = r431128 - r431129;
        double r431131 = r431119 - r431129;
        double r431132 = r431130 / r431131;
        double r431133 = r431126 * r431132;
        double r431134 = r431127 - r431133;
        double r431135 = r431126 + r431134;
        double r431136 = r431128 / r431129;
        double r431137 = r431126 * r431136;
        double r431138 = r431127 + r431137;
        double r431139 = r431125 ? r431135 : r431138;
        return r431139;
}

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

Original16.4
Target8.5
Herbie8.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 a < -4.072147695298825e-86

    1. Initial program 14.4

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

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

      \[\leadsto \color{blue}{x + \left(y - \frac{z - t}{\frac{a - t}{y}}\right)}\]
    6. Using strategy rm
    7. Applied div-inv7.0

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

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

    if -4.072147695298825e-86 < a < 3.0765839532615577e-124

    1. Initial program 20.1

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

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

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

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

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

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

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

    if 3.0765839532615577e-124 < a

    1. Initial program 15.0

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

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

      \[\leadsto \color{blue}{x + \left(y - \frac{z - t}{\frac{a - t}{y}}\right)}\]
    6. Using strategy rm
    7. Applied div-inv8.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -4.072147695298824991622230320368106205265 \cdot 10^{-86} \lor \neg \left(a \le 3.076583953261557678467109322067364719153 \cdot 10^{-124}\right):\\ \;\;\;\;y + \left(x - y \cdot \frac{z - t}{a - t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \end{array}\]

Reproduce

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