Average Error: 10.7 → 0.3
Time: 3.4s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(z - t\right)}{z - a} = -\infty:\\ \;\;\;\;\mathsf{fma}\left(y \cdot \frac{1}{z - a}, z - t, x\right)\\ \mathbf{elif}\;\frac{y \cdot \left(z - t\right)}{z - a} \le 2.2407220177282239 \cdot 10^{307}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{z - a}
\begin{array}{l}
\mathbf{if}\;\frac{y \cdot \left(z - t\right)}{z - a} = -\infty:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \frac{1}{z - a}, z - t, x\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r518275 = x;
        double r518276 = y;
        double r518277 = z;
        double r518278 = t;
        double r518279 = r518277 - r518278;
        double r518280 = r518276 * r518279;
        double r518281 = a;
        double r518282 = r518277 - r518281;
        double r518283 = r518280 / r518282;
        double r518284 = r518275 + r518283;
        return r518284;
}

double f(double x, double y, double z, double t, double a) {
        double r518285 = y;
        double r518286 = z;
        double r518287 = t;
        double r518288 = r518286 - r518287;
        double r518289 = r518285 * r518288;
        double r518290 = a;
        double r518291 = r518286 - r518290;
        double r518292 = r518289 / r518291;
        double r518293 = -inf.0;
        bool r518294 = r518292 <= r518293;
        double r518295 = 1.0;
        double r518296 = r518295 / r518291;
        double r518297 = r518285 * r518296;
        double r518298 = x;
        double r518299 = fma(r518297, r518288, r518298);
        double r518300 = 2.240722017728224e+307;
        bool r518301 = r518292 <= r518300;
        double r518302 = r518298 + r518292;
        double r518303 = r518288 / r518291;
        double r518304 = r518285 * r518303;
        double r518305 = r518298 + r518304;
        double r518306 = r518301 ? r518302 : r518305;
        double r518307 = r518294 ? r518299 : r518306;
        return r518307;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

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

Derivation

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

    1. Initial program 64.0

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

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

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

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

    1. Initial program 0.4

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

    if 2.240722017728224e+307 < (/ (* y (- z t)) (- z a))

    1. Initial program 63.9

      \[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity63.9

      \[\leadsto x + \frac{y \cdot \left(z - t\right)}{\color{blue}{1 \cdot \left(z - a\right)}}\]
    4. Applied times-frac0.2

      \[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{z - t}{z - a}}\]
    5. Simplified0.2

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

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

Reproduce

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

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

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