Average Error: 17.0 → 7.0
Time: 5.6s
Precision: 64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -5.38482551233063052 \cdot 10^{-225}:\\ \;\;\;\;x + y \cdot \left(1 - \frac{1}{\frac{a - t}{z - t}}\right)\\ \mathbf{elif}\;a \le 1.36251296932317456 \cdot 10^{-123}:\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \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}\;a \le -5.38482551233063052 \cdot 10^{-225}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{1}{\frac{a - t}{z - t}}\right)\\

\mathbf{elif}\;a \le 1.36251296932317456 \cdot 10^{-123}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\

\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 r722134 = x;
        double r722135 = y;
        double r722136 = r722134 + r722135;
        double r722137 = z;
        double r722138 = t;
        double r722139 = r722137 - r722138;
        double r722140 = r722139 * r722135;
        double r722141 = a;
        double r722142 = r722141 - r722138;
        double r722143 = r722140 / r722142;
        double r722144 = r722136 - r722143;
        return r722144;
}

double f(double x, double y, double z, double t, double a) {
        double r722145 = a;
        double r722146 = -5.3848255123306305e-225;
        bool r722147 = r722145 <= r722146;
        double r722148 = x;
        double r722149 = y;
        double r722150 = 1.0;
        double r722151 = t;
        double r722152 = r722145 - r722151;
        double r722153 = z;
        double r722154 = r722153 - r722151;
        double r722155 = r722152 / r722154;
        double r722156 = r722150 / r722155;
        double r722157 = r722150 - r722156;
        double r722158 = r722149 * r722157;
        double r722159 = r722148 + r722158;
        double r722160 = 1.3625129693231746e-123;
        bool r722161 = r722145 <= r722160;
        double r722162 = r722153 / r722151;
        double r722163 = r722149 * r722162;
        double r722164 = r722148 + r722163;
        double r722165 = r722150 / r722152;
        double r722166 = r722154 * r722165;
        double r722167 = r722150 - r722166;
        double r722168 = r722149 * r722167;
        double r722169 = r722148 + r722168;
        double r722170 = r722161 ? r722164 : r722169;
        double r722171 = r722147 ? r722159 : r722170;
        return r722171;
}

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.5
Herbie7.0
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \lt -1.3664970889390727 \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.47542934445772333 \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 < -5.3848255123306305e-225

    1. Initial program 16.3

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

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

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

      \[\leadsto \left(x + y\right) - \color{blue}{\frac{\frac{z - t}{a - t}}{\frac{1}{y}}}\]
    7. Using strategy rm
    8. Applied associate--l+7.8

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

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

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

    if -5.3848255123306305e-225 < a < 1.3625129693231746e-123

    1. Initial program 20.6

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

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

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

      \[\leadsto \left(x + y\right) - \color{blue}{\frac{\frac{z - t}{a - t}}{\frac{1}{y}}}\]
    7. Using strategy rm
    8. Applied associate--l+13.0

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

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

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

    if 1.3625129693231746e-123 < a

    1. Initial program 15.9

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

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

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

      \[\leadsto \left(x + y\right) - \color{blue}{\frac{\frac{z - t}{a - t}}{\frac{1}{y}}}\]
    7. Using strategy rm
    8. Applied associate--l+6.1

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

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

      \[\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.0

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

Reproduce

herbie shell --seed 2020036 
(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-07) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y))))

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