Average Error: 23.1 → 23.6
Time: 15.5s
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \le 1.273171169071947 \cdot 10^{+184}:\\ \;\;\;\;\frac{\mathsf{fma}\left(z, t - a, x \cdot y\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\ \mathbf{elif}\;x \le 6.28393270841488 \cdot 10^{+258}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t - a, x \cdot y\right) \cdot \frac{1}{\mathsf{fma}\left(z, b - y, y\right)}\\ \end{array}\]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\begin{array}{l}
\mathbf{if}\;x \le 1.273171169071947 \cdot 10^{+184}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, t - a, x \cdot y\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\

\mathbf{elif}\;x \le 6.28393270841488 \cdot 10^{+258}:\\
\;\;\;\;x\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r14249952 = x;
        double r14249953 = y;
        double r14249954 = r14249952 * r14249953;
        double r14249955 = z;
        double r14249956 = t;
        double r14249957 = a;
        double r14249958 = r14249956 - r14249957;
        double r14249959 = r14249955 * r14249958;
        double r14249960 = r14249954 + r14249959;
        double r14249961 = b;
        double r14249962 = r14249961 - r14249953;
        double r14249963 = r14249955 * r14249962;
        double r14249964 = r14249953 + r14249963;
        double r14249965 = r14249960 / r14249964;
        return r14249965;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r14249966 = x;
        double r14249967 = 1.273171169071947e+184;
        bool r14249968 = r14249966 <= r14249967;
        double r14249969 = z;
        double r14249970 = t;
        double r14249971 = a;
        double r14249972 = r14249970 - r14249971;
        double r14249973 = y;
        double r14249974 = r14249966 * r14249973;
        double r14249975 = fma(r14249969, r14249972, r14249974);
        double r14249976 = b;
        double r14249977 = r14249976 - r14249973;
        double r14249978 = fma(r14249969, r14249977, r14249973);
        double r14249979 = r14249975 / r14249978;
        double r14249980 = 6.28393270841488e+258;
        bool r14249981 = r14249966 <= r14249980;
        double r14249982 = 1.0;
        double r14249983 = r14249982 / r14249978;
        double r14249984 = r14249975 * r14249983;
        double r14249985 = r14249981 ? r14249966 : r14249984;
        double r14249986 = r14249968 ? r14249979 : r14249985;
        return r14249986;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Target

Original23.1
Target17.7
Herbie23.6
\[\frac{z \cdot t + y \cdot x}{y + z \cdot \left(b - y\right)} - \frac{a}{\left(b - y\right) + \frac{y}{z}}\]

Derivation

  1. Split input into 3 regimes
  2. if x < 1.273171169071947e+184

    1. Initial program 22.0

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity22.0

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{\color{blue}{1 \cdot \left(y + z \cdot \left(b - y\right)\right)}}\]
    4. Applied *-un-lft-identity22.0

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

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

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

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

    if 1.273171169071947e+184 < x < 6.28393270841488e+258

    1. Initial program 31.0

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity31.0

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{\color{blue}{1 \cdot \left(y + z \cdot \left(b - y\right)\right)}}\]
    4. Applied *-un-lft-identity31.0

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{\mathsf{fma}\left(z, t - a, x \cdot y\right)}{\mathsf{fma}\left(z, b - y, y\right)}}\]
    8. Taylor expanded around 0 39.4

      \[\leadsto 1 \cdot \color{blue}{x}\]

    if 6.28393270841488e+258 < x

    1. Initial program 36.0

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity36.0

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{\color{blue}{1 \cdot \left(y + z \cdot \left(b - y\right)\right)}}\]
    4. Applied *-un-lft-identity36.0

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{\mathsf{fma}\left(z, t - a, x \cdot y\right)}{\mathsf{fma}\left(z, b - y, y\right)}}\]
    8. Using strategy rm
    9. Applied div-inv36.0

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

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

Reproduce

herbie shell --seed 2019156 +o rules:numerics
(FPCore (x y z t a b)
  :name "Development.Shake.Progress:decay from shake-0.15.5"

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

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