Average Error: 10.8 → 1.0
Time: 16.6s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le 3.91409457080451341356217564049176136337 \cdot 10^{-265} \lor \neg \left(y \le 1.277502191388937042011677378683335089821 \cdot 10^{-82}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \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 3.91409457080451341356217564049176136337 \cdot 10^{-265} \lor \neg \left(y \le 1.277502191388937042011677378683335089821 \cdot 10^{-82}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{a - t}\\

\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 r478051 = x;
        double r478052 = y;
        double r478053 = z;
        double r478054 = t;
        double r478055 = r478053 - r478054;
        double r478056 = r478052 * r478055;
        double r478057 = a;
        double r478058 = r478057 - r478054;
        double r478059 = r478056 / r478058;
        double r478060 = r478051 + r478059;
        return r478060;
}

double f(double x, double y, double z, double t, double a) {
        double r478061 = y;
        double r478062 = 3.9140945708045134e-265;
        bool r478063 = r478061 <= r478062;
        double r478064 = 1.277502191388937e-82;
        bool r478065 = r478061 <= r478064;
        double r478066 = !r478065;
        bool r478067 = r478063 || r478066;
        double r478068 = x;
        double r478069 = z;
        double r478070 = t;
        double r478071 = r478069 - r478070;
        double r478072 = a;
        double r478073 = r478072 - r478070;
        double r478074 = r478071 / r478073;
        double r478075 = r478061 * r478074;
        double r478076 = r478068 + r478075;
        double r478077 = r478071 * r478061;
        double r478078 = r478077 / r478073;
        double r478079 = r478078 + r478068;
        double r478080 = r478067 ? r478076 : r478079;
        return r478080;
}

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

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

Derivation

  1. Split input into 2 regimes
  2. if y < 3.9140945708045134e-265 or 1.277502191388937e-82 < y

    1. Initial program 12.7

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

      \[\leadsto \color{blue}{\frac{y \cdot \left(z - t\right)}{a - t} + x}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity12.7

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

      \[\leadsto \color{blue}{\frac{y}{1} \cdot \frac{z - t}{a - t}} + x\]
    6. Simplified1.1

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

    if 3.9140945708045134e-265 < y < 1.277502191388937e-82

    1. Initial program 0.4

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

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

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

Reproduce

herbie shell --seed 2019179 
(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))))