Average Error: 1.5 → 0.9
Time: 20.1s
Precision: 64
\[x + y \cdot \frac{z - t}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -3.333121669551157994362509217149128294058 \cdot 10^{-155} \lor \neg \left(y \le 1.287949566750880373322938289200549836114 \cdot 10^{56}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\ \end{array}\]
x + y \cdot \frac{z - t}{z - a}
\begin{array}{l}
\mathbf{if}\;y \le -3.333121669551157994362509217149128294058 \cdot 10^{-155} \lor \neg \left(y \le 1.287949566750880373322938289200549836114 \cdot 10^{56}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z - a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r436115 = x;
        double r436116 = y;
        double r436117 = z;
        double r436118 = t;
        double r436119 = r436117 - r436118;
        double r436120 = a;
        double r436121 = r436117 - r436120;
        double r436122 = r436119 / r436121;
        double r436123 = r436116 * r436122;
        double r436124 = r436115 + r436123;
        return r436124;
}

double f(double x, double y, double z, double t, double a) {
        double r436125 = y;
        double r436126 = -3.333121669551158e-155;
        bool r436127 = r436125 <= r436126;
        double r436128 = 1.2879495667508804e+56;
        bool r436129 = r436125 <= r436128;
        double r436130 = !r436129;
        bool r436131 = r436127 || r436130;
        double r436132 = x;
        double r436133 = z;
        double r436134 = t;
        double r436135 = r436133 - r436134;
        double r436136 = a;
        double r436137 = r436133 - r436136;
        double r436138 = r436135 / r436137;
        double r436139 = r436125 * r436138;
        double r436140 = r436132 + r436139;
        double r436141 = r436125 * r436135;
        double r436142 = r436141 / r436137;
        double r436143 = r436132 + r436142;
        double r436144 = r436131 ? r436140 : r436143;
        return r436144;
}

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

Original1.5
Target1.4
Herbie0.9
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -3.333121669551158e-155 or 1.2879495667508804e+56 < y

    1. Initial program 1.0

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

    if -3.333121669551158e-155 < y < 1.2879495667508804e+56

    1. Initial program 2.1

      \[x + y \cdot \frac{z - t}{z - a}\]
    2. Using strategy rm
    3. Applied associate-*r/0.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -3.333121669551157994362509217149128294058 \cdot 10^{-155} \lor \neg \left(y \le 1.287949566750880373322938289200549836114 \cdot 10^{56}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\ \end{array}\]

Reproduce

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

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

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