Average Error: 11.2 → 1.2
Time: 36.6s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.396782542908176268213433022188939989147 \cdot 10^{278}:\\ \;\;\;\;x + \frac{y}{a - t} \cdot \left(z - t\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{a - t} \cdot y + \mathsf{fma}\left(y, \frac{-t}{a - t}, x\right)\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;z \le -1.396782542908176268213433022188939989147 \cdot 10^{278}:\\
\;\;\;\;x + \frac{y}{a - t} \cdot \left(z - t\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r20013883 = x;
        double r20013884 = y;
        double r20013885 = z;
        double r20013886 = t;
        double r20013887 = r20013885 - r20013886;
        double r20013888 = r20013884 * r20013887;
        double r20013889 = a;
        double r20013890 = r20013889 - r20013886;
        double r20013891 = r20013888 / r20013890;
        double r20013892 = r20013883 + r20013891;
        return r20013892;
}

double f(double x, double y, double z, double t, double a) {
        double r20013893 = z;
        double r20013894 = -1.3967825429081763e+278;
        bool r20013895 = r20013893 <= r20013894;
        double r20013896 = x;
        double r20013897 = y;
        double r20013898 = a;
        double r20013899 = t;
        double r20013900 = r20013898 - r20013899;
        double r20013901 = r20013897 / r20013900;
        double r20013902 = r20013893 - r20013899;
        double r20013903 = r20013901 * r20013902;
        double r20013904 = r20013896 + r20013903;
        double r20013905 = r20013893 / r20013900;
        double r20013906 = r20013905 * r20013897;
        double r20013907 = -r20013899;
        double r20013908 = r20013907 / r20013900;
        double r20013909 = fma(r20013897, r20013908, r20013896);
        double r20013910 = r20013906 + r20013909;
        double r20013911 = r20013895 ? r20013904 : r20013910;
        return r20013911;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original11.2
Target1.2
Herbie1.2
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -1.3967825429081763e+278

    1. Initial program 15.9

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

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

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

    if -1.3967825429081763e+278 < z

    1. Initial program 11.1

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

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

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

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

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

      \[\leadsto y \cdot \color{blue}{\frac{z - t}{a - t}} + x\]
    9. Using strategy rm
    10. Applied div-sub1.1

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

      \[\leadsto y \cdot \color{blue}{\left(\frac{z}{a - t} + \left(-\frac{t}{a - t}\right)\right)} + x\]
    13. Applied distribute-lft-in1.1

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

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

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

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

Reproduce

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

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

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