Average Error: 22.1 → 19.6
Time: 19.4s
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.0995968184298553 \cdot 10^{+73}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{elif}\;z \le -9.689336201481151 \cdot 10^{-225}:\\ \;\;\;\;\frac{z \cdot \left(t - a\right) + x \cdot y}{z \cdot \left(b - y\right) + y}\\ \mathbf{elif}\;z \le -1.1807804438070255 \cdot 10^{-295}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \le 1.122440542385563 \cdot 10^{+206}:\\ \;\;\;\;\frac{z \cdot \left(t - a\right) + x \cdot y}{z \cdot \left(b - y\right) + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \end{array}\]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\begin{array}{l}
\mathbf{if}\;z \le -2.0995968184298553 \cdot 10^{+73}:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{elif}\;z \le -9.689336201481151 \cdot 10^{-225}:\\
\;\;\;\;\frac{z \cdot \left(t - a\right) + x \cdot y}{z \cdot \left(b - y\right) + y}\\

\mathbf{elif}\;z \le -1.1807804438070255 \cdot 10^{-295}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \le 1.122440542385563 \cdot 10^{+206}:\\
\;\;\;\;\frac{z \cdot \left(t - a\right) + x \cdot y}{z \cdot \left(b - y\right) + y}\\

\mathbf{else}:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r41583633 = x;
        double r41583634 = y;
        double r41583635 = r41583633 * r41583634;
        double r41583636 = z;
        double r41583637 = t;
        double r41583638 = a;
        double r41583639 = r41583637 - r41583638;
        double r41583640 = r41583636 * r41583639;
        double r41583641 = r41583635 + r41583640;
        double r41583642 = b;
        double r41583643 = r41583642 - r41583634;
        double r41583644 = r41583636 * r41583643;
        double r41583645 = r41583634 + r41583644;
        double r41583646 = r41583641 / r41583645;
        return r41583646;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r41583647 = z;
        double r41583648 = -2.0995968184298553e+73;
        bool r41583649 = r41583647 <= r41583648;
        double r41583650 = t;
        double r41583651 = b;
        double r41583652 = r41583650 / r41583651;
        double r41583653 = a;
        double r41583654 = r41583653 / r41583651;
        double r41583655 = r41583652 - r41583654;
        double r41583656 = -9.689336201481151e-225;
        bool r41583657 = r41583647 <= r41583656;
        double r41583658 = r41583650 - r41583653;
        double r41583659 = r41583647 * r41583658;
        double r41583660 = x;
        double r41583661 = y;
        double r41583662 = r41583660 * r41583661;
        double r41583663 = r41583659 + r41583662;
        double r41583664 = r41583651 - r41583661;
        double r41583665 = r41583647 * r41583664;
        double r41583666 = r41583665 + r41583661;
        double r41583667 = r41583663 / r41583666;
        double r41583668 = -1.1807804438070255e-295;
        bool r41583669 = r41583647 <= r41583668;
        double r41583670 = 1.122440542385563e+206;
        bool r41583671 = r41583647 <= r41583670;
        double r41583672 = r41583671 ? r41583667 : r41583655;
        double r41583673 = r41583669 ? r41583660 : r41583672;
        double r41583674 = r41583657 ? r41583667 : r41583673;
        double r41583675 = r41583649 ? r41583655 : r41583674;
        return r41583675;
}

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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original22.1
Target16.7
Herbie19.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 z < -2.0995968184298553e+73 or 1.122440542385563e+206 < z

    1. Initial program 45.3

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

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

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{\color{blue}{\left(b - y\right) \cdot z} + y}\]
    6. Using strategy rm
    7. Applied clear-num45.4

      \[\leadsto \color{blue}{\frac{1}{\frac{\left(b - y\right) \cdot z + y}{x \cdot y + z \cdot \left(t - a\right)}}}\]
    8. Taylor expanded around inf 33.1

      \[\leadsto \color{blue}{\frac{t}{b} - \frac{a}{b}}\]

    if -2.0995968184298553e+73 < z < -9.689336201481151e-225 or -1.1807804438070255e-295 < z < 1.122440542385563e+206

    1. Initial program 14.0

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

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{\color{blue}{z \cdot \left(b - y\right) + y}}\]
    4. Using strategy rm
    5. Applied *-commutative14.0

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

    if -9.689336201481151e-225 < z < -1.1807804438070255e-295

    1. Initial program 8.6

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied +-commutative8.6

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{\color{blue}{z \cdot \left(b - y\right) + y}}\]
    4. Using strategy rm
    5. Applied *-commutative8.6

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{\color{blue}{\left(b - y\right) \cdot z} + y}\]
    6. Using strategy rm
    7. Applied clear-num8.8

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

      \[\leadsto \color{blue}{x}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification19.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.0995968184298553 \cdot 10^{+73}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{elif}\;z \le -9.689336201481151 \cdot 10^{-225}:\\ \;\;\;\;\frac{z \cdot \left(t - a\right) + x \cdot y}{z \cdot \left(b - y\right) + y}\\ \mathbf{elif}\;z \le -1.1807804438070255 \cdot 10^{-295}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \le 1.122440542385563 \cdot 10^{+206}:\\ \;\;\;\;\frac{z \cdot \left(t - a\right) + x \cdot y}{z \cdot \left(b - y\right) + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \end{array}\]

Reproduce

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