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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r24062116 = x;
        double r24062117 = y;
        double r24062118 = z;
        double r24062119 = t;
        double r24062120 = r24062118 - r24062119;
        double r24062121 = r24062117 * r24062120;
        double r24062122 = a;
        double r24062123 = r24062122 - r24062119;
        double r24062124 = r24062121 / r24062123;
        double r24062125 = r24062116 + r24062124;
        return r24062125;
}

double f(double x, double y, double z, double t, double a) {
        double r24062126 = z;
        double r24062127 = t;
        double r24062128 = r24062126 - r24062127;
        double r24062129 = y;
        double r24062130 = r24062128 * r24062129;
        double r24062131 = a;
        double r24062132 = r24062131 - r24062127;
        double r24062133 = r24062130 / r24062132;
        double r24062134 = -inf.0;
        bool r24062135 = r24062133 <= r24062134;
        double r24062136 = 1.0;
        double r24062137 = r24062136 / r24062132;
        double r24062138 = r24062136 / r24062129;
        double r24062139 = r24062137 / r24062138;
        double r24062140 = x;
        double r24062141 = fma(r24062139, r24062128, r24062140);
        double r24062142 = 2.3405101687246508e+255;
        bool r24062143 = r24062133 <= r24062142;
        double r24062144 = r24062140 + r24062133;
        double r24062145 = r24062132 / r24062129;
        double r24062146 = r24062136 / r24062145;
        double r24062147 = fma(r24062146, r24062128, r24062140);
        double r24062148 = r24062143 ? r24062144 : r24062147;
        double r24062149 = r24062135 ? r24062141 : r24062148;
        return r24062149;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original10.8
Target1.2
Herbie0.5
\[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 clear-num0.3

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

      \[\leadsto \mathsf{fma}\left(\frac{1}{\color{blue}{\left(a - t\right) \cdot \frac{1}{y}}}, z - t, x\right)\]
    7. Applied associate-/r*0.3

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

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

    1. Initial program 0.2

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

    if 2.3405101687246508e+255 < (/ (* y (- z t)) (- a t))

    1. Initial program 55.6

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

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

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

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

Reproduce

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