Average Error: 1.3 → 0.8
Time: 15.5s
Precision: 64
\[x + y \cdot \frac{z - t}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.96569407923771146619189397424219138248 \cdot 10^{64}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y \le 7.263410915894397149935390488504227812988 \cdot 10^{-99}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{1}{\frac{a - t}{z - t}}\\ \end{array}\]
x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
\mathbf{if}\;y \le -1.96569407923771146619189397424219138248 \cdot 10^{64}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a - t}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r665559 = x;
        double r665560 = y;
        double r665561 = z;
        double r665562 = t;
        double r665563 = r665561 - r665562;
        double r665564 = a;
        double r665565 = r665564 - r665562;
        double r665566 = r665563 / r665565;
        double r665567 = r665560 * r665566;
        double r665568 = r665559 + r665567;
        return r665568;
}

double f(double x, double y, double z, double t, double a) {
        double r665569 = y;
        double r665570 = -1.9656940792377115e+64;
        bool r665571 = r665569 <= r665570;
        double r665572 = x;
        double r665573 = z;
        double r665574 = t;
        double r665575 = r665573 - r665574;
        double r665576 = a;
        double r665577 = r665576 - r665574;
        double r665578 = r665575 / r665577;
        double r665579 = r665569 * r665578;
        double r665580 = r665572 + r665579;
        double r665581 = 7.263410915894397e-99;
        bool r665582 = r665569 <= r665581;
        double r665583 = r665569 * r665575;
        double r665584 = 1.0;
        double r665585 = r665584 / r665577;
        double r665586 = r665583 * r665585;
        double r665587 = r665572 + r665586;
        double r665588 = r665577 / r665575;
        double r665589 = r665584 / r665588;
        double r665590 = r665569 * r665589;
        double r665591 = r665572 + r665590;
        double r665592 = r665582 ? r665587 : r665591;
        double r665593 = r665571 ? r665580 : r665592;
        return r665593;
}

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.3
Target0.4
Herbie0.8
\[\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 3 regimes
  2. if y < -1.9656940792377115e+64

    1. Initial program 0.4

      \[x + y \cdot \frac{z - t}{a - t}\]

    if -1.9656940792377115e+64 < y < 7.263410915894397e-99

    1. Initial program 2.1

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

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

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

    if 7.263410915894397e-99 < y

    1. Initial program 0.7

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

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

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

Reproduce

herbie shell --seed 2019209 
(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.50808486055124107e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.8944268627920891e-49) (+ x (* (* y (- z t)) (/ 1 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))

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