Average Error: 11.0 → 1.6
Time: 3.9s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -5.610173163155118 \cdot 10^{-108} \lor \neg \left(y \le 59977.7525706290544\right):\\ \;\;\;\;\left(z - t\right) \cdot \frac{y}{a - t} + x\\ \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 -5.610173163155118 \cdot 10^{-108} \lor \neg \left(y \le 59977.7525706290544\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a - t} + x\\

\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 r504848 = x;
        double r504849 = y;
        double r504850 = z;
        double r504851 = t;
        double r504852 = r504850 - r504851;
        double r504853 = r504849 * r504852;
        double r504854 = a;
        double r504855 = r504854 - r504851;
        double r504856 = r504853 / r504855;
        double r504857 = r504848 + r504856;
        return r504857;
}

double f(double x, double y, double z, double t, double a) {
        double r504858 = y;
        double r504859 = -5.610173163155118e-108;
        bool r504860 = r504858 <= r504859;
        double r504861 = 59977.752570629054;
        bool r504862 = r504858 <= r504861;
        double r504863 = !r504862;
        bool r504864 = r504860 || r504863;
        double r504865 = z;
        double r504866 = t;
        double r504867 = r504865 - r504866;
        double r504868 = a;
        double r504869 = r504868 - r504866;
        double r504870 = r504858 / r504869;
        double r504871 = r504867 * r504870;
        double r504872 = x;
        double r504873 = r504871 + r504872;
        double r504874 = r504867 * r504858;
        double r504875 = r504874 / r504869;
        double r504876 = r504875 + r504872;
        double r504877 = r504864 ? r504873 : r504876;
        return r504877;
}

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

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

Derivation

  1. Split input into 2 regimes
  2. if y < -5.610173163155118e-108 or 59977.752570629054 < y

    1. Initial program 19.9

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

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

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

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

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

    if -5.610173163155118e-108 < y < 59977.752570629054

    1. Initial program 0.3

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

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

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

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

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

      \[\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 -5.610173163155118 \cdot 10^{-108} \lor \neg \left(y \le 59977.7525706290544\right):\\ \;\;\;\;\left(z - t\right) \cdot \frac{y}{a - t} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{a - t} + x\\ \end{array}\]

Reproduce

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