Average Error: 1.4 → 0.9
Time: 16.5s
Precision: 64
\[x + y \cdot \frac{z - t}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.072361122530726800725634858682369937409 \cdot 10^{71} \lor \neg \left(y \le 1.007684012237224146847316966965214691878 \cdot 10^{-126}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(z - t\right)}{z - a} + x\\ \end{array}\]
x + y \cdot \frac{z - t}{z - a}
\begin{array}{l}
\mathbf{if}\;y \le -4.072361122530726800725634858682369937409 \cdot 10^{71} \lor \neg \left(y \le 1.007684012237224146847316966965214691878 \cdot 10^{-126}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z - a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r444993 = x;
        double r444994 = y;
        double r444995 = z;
        double r444996 = t;
        double r444997 = r444995 - r444996;
        double r444998 = a;
        double r444999 = r444995 - r444998;
        double r445000 = r444997 / r444999;
        double r445001 = r444994 * r445000;
        double r445002 = r444993 + r445001;
        return r445002;
}

double f(double x, double y, double z, double t, double a) {
        double r445003 = y;
        double r445004 = -4.072361122530727e+71;
        bool r445005 = r445003 <= r445004;
        double r445006 = 1.0076840122372241e-126;
        bool r445007 = r445003 <= r445006;
        double r445008 = !r445007;
        bool r445009 = r445005 || r445008;
        double r445010 = x;
        double r445011 = z;
        double r445012 = t;
        double r445013 = r445011 - r445012;
        double r445014 = a;
        double r445015 = r445011 - r445014;
        double r445016 = r445013 / r445015;
        double r445017 = r445003 * r445016;
        double r445018 = r445010 + r445017;
        double r445019 = r445003 * r445013;
        double r445020 = r445019 / r445015;
        double r445021 = r445020 + r445010;
        double r445022 = r445009 ? r445018 : r445021;
        return r445022;
}

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.4
Target1.3
Herbie0.9
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -4.072361122530727e+71 or 1.0076840122372241e-126 < y

    1. Initial program 0.6

      \[x + y \cdot \frac{z - t}{z - a}\]
    2. Simplified0.6

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{z - t}{z - a}} + x\]
    8. Using strategy rm
    9. Applied pow10.6

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

    if -4.072361122530727e+71 < y < 1.0076840122372241e-126

    1. Initial program 2.3

      \[x + y \cdot \frac{z - t}{z - a}\]
    2. Simplified2.3

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z - a}{z - t}} \cdot y + x}\]
    7. Simplified2.3

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

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

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

Reproduce

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