Average Error: 10.7 → 0.4
Time: 10.1s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a - t} = -\infty:\\ \;\;\;\;y \cdot \frac{z - t}{a - t} + x\\ \mathbf{elif}\;\frac{y \cdot \left(z - t\right)}{a - t} \le 9.3659874253411419 \cdot 10^{269}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a - t} \cdot \left(z - t\right) + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a - t} = -\infty:\\
\;\;\;\;y \cdot \frac{z - t}{a - t} + x\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r340499 = x;
        double r340500 = y;
        double r340501 = z;
        double r340502 = t;
        double r340503 = r340501 - r340502;
        double r340504 = r340500 * r340503;
        double r340505 = a;
        double r340506 = r340505 - r340502;
        double r340507 = r340504 / r340506;
        double r340508 = r340499 + r340507;
        return r340508;
}

double f(double x, double y, double z, double t, double a) {
        double r340509 = y;
        double r340510 = z;
        double r340511 = t;
        double r340512 = r340510 - r340511;
        double r340513 = r340509 * r340512;
        double r340514 = a;
        double r340515 = r340514 - r340511;
        double r340516 = r340513 / r340515;
        double r340517 = -inf.0;
        bool r340518 = r340516 <= r340517;
        double r340519 = r340512 / r340515;
        double r340520 = r340509 * r340519;
        double r340521 = x;
        double r340522 = r340520 + r340521;
        double r340523 = 9.365987425341142e+269;
        bool r340524 = r340516 <= r340523;
        double r340525 = r340521 + r340516;
        double r340526 = r340509 / r340515;
        double r340527 = r340526 * r340512;
        double r340528 = r340527 + r340521;
        double r340529 = r340524 ? r340525 : r340528;
        double r340530 = r340518 ? r340522 : r340529;
        return r340530;
}

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

Original10.7
Target1.3
Herbie0.4
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (* y (- z t)) (- a t)) < -inf.0

    1. Initial program 64.0

      \[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
    2. Simplified0.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{a - t}, z - t, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef0.2

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

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

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

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

    if -inf.0 < (/ (* y (- z t)) (- a t)) < 9.365987425341142e+269

    1. Initial program 0.2

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

    if 9.365987425341142e+269 < (/ (* y (- z t)) (- a t))

    1. Initial program 58.1

      \[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
    2. Simplified2.5

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{a - t}, z - t, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef2.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a - t} = -\infty:\\ \;\;\;\;y \cdot \frac{z - t}{a - t} + x\\ \mathbf{elif}\;\frac{y \cdot \left(z - t\right)}{a - t} \le 9.3659874253411419 \cdot 10^{269}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a - t} \cdot \left(z - t\right) + x\\ \end{array}\]

Reproduce

herbie shell --seed 2020043 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
  :precision binary64

  :herbie-target
  (+ x (/ y (/ (- a t) (- z t))))

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