Average Error: 11.1 → 1.6
Time: 16.8s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -15616133185154908021587968 \lor \neg \left(y \le 7.354120544912667021540022542939697214224 \cdot 10^{-76}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a - t}, z - t, x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{a - t} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;y \le -15616133185154908021587968 \lor \neg \left(y \le 7.354120544912667021540022542939697214224 \cdot 10^{-76}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a - t}, z - t, x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r388079 = x;
        double r388080 = y;
        double r388081 = z;
        double r388082 = t;
        double r388083 = r388081 - r388082;
        double r388084 = r388080 * r388083;
        double r388085 = a;
        double r388086 = r388085 - r388082;
        double r388087 = r388084 / r388086;
        double r388088 = r388079 + r388087;
        return r388088;
}

double f(double x, double y, double z, double t, double a) {
        double r388089 = y;
        double r388090 = -1.5616133185154908e+25;
        bool r388091 = r388089 <= r388090;
        double r388092 = 7.354120544912667e-76;
        bool r388093 = r388089 <= r388092;
        double r388094 = !r388093;
        bool r388095 = r388091 || r388094;
        double r388096 = a;
        double r388097 = t;
        double r388098 = r388096 - r388097;
        double r388099 = r388089 / r388098;
        double r388100 = z;
        double r388101 = r388100 - r388097;
        double r388102 = x;
        double r388103 = fma(r388099, r388101, r388102);
        double r388104 = r388101 * r388089;
        double r388105 = r388104 / r388098;
        double r388106 = r388105 + r388102;
        double r388107 = r388095 ? r388103 : r388106;
        return r388107;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

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

Derivation

  1. Split input into 2 regimes
  2. if y < -1.5616133185154908e+25 or 7.354120544912667e-76 < y

    1. Initial program 21.4

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

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

    if -1.5616133185154908e+25 < y < 7.354120544912667e-76

    1. Initial program 0.5

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{y \cdot \frac{1}{a - t}}, z - t, x\right)\]
    5. Using strategy rm
    6. Applied fma-udef4.0

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

      \[\leadsto \color{blue}{\left(z - t\right) \cdot \frac{y}{a - t}} + x\]
    8. Using strategy rm
    9. Applied associate-*r/0.5

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

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

Reproduce

herbie shell --seed 2019305 +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))))