Average Error: 19.4 → 9.0
Time: 20.0s
Precision: 64
\[\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
\[\begin{array}{l} \mathbf{if}\;b \le -3.7234362224650237 \cdot 10^{-13}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + \left(\frac{x}{\frac{c}{y}} \cdot \frac{1}{z}\right) \cdot 9.0\right) - 4.0 \cdot \left(\frac{t}{c} \cdot a\right)\\ \mathbf{elif}\;b \le 2.210437770349525 \cdot 10^{-37}:\\ \;\;\;\;\frac{\left(\frac{b}{z} + 9.0 \cdot \frac{y \cdot x}{z}\right) - \left(4.0 \cdot t\right) \cdot a}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(9.0 \cdot \frac{1}{\frac{\frac{c \cdot z}{y}}{x}} + \frac{b}{c \cdot z}\right) - 4.0 \cdot \left(\frac{t}{c} \cdot a\right)\\ \end{array}\]
\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\begin{array}{l}
\mathbf{if}\;b \le -3.7234362224650237 \cdot 10^{-13}:\\
\;\;\;\;\left(\frac{b}{c \cdot z} + \left(\frac{x}{\frac{c}{y}} \cdot \frac{1}{z}\right) \cdot 9.0\right) - 4.0 \cdot \left(\frac{t}{c} \cdot a\right)\\

\mathbf{elif}\;b \le 2.210437770349525 \cdot 10^{-37}:\\
\;\;\;\;\frac{\left(\frac{b}{z} + 9.0 \cdot \frac{y \cdot x}{z}\right) - \left(4.0 \cdot t\right) \cdot a}{c}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r34010664 = x;
        double r34010665 = 9.0;
        double r34010666 = r34010664 * r34010665;
        double r34010667 = y;
        double r34010668 = r34010666 * r34010667;
        double r34010669 = z;
        double r34010670 = 4.0;
        double r34010671 = r34010669 * r34010670;
        double r34010672 = t;
        double r34010673 = r34010671 * r34010672;
        double r34010674 = a;
        double r34010675 = r34010673 * r34010674;
        double r34010676 = r34010668 - r34010675;
        double r34010677 = b;
        double r34010678 = r34010676 + r34010677;
        double r34010679 = c;
        double r34010680 = r34010669 * r34010679;
        double r34010681 = r34010678 / r34010680;
        return r34010681;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r34010682 = b;
        double r34010683 = -3.7234362224650237e-13;
        bool r34010684 = r34010682 <= r34010683;
        double r34010685 = c;
        double r34010686 = z;
        double r34010687 = r34010685 * r34010686;
        double r34010688 = r34010682 / r34010687;
        double r34010689 = x;
        double r34010690 = y;
        double r34010691 = r34010685 / r34010690;
        double r34010692 = r34010689 / r34010691;
        double r34010693 = 1.0;
        double r34010694 = r34010693 / r34010686;
        double r34010695 = r34010692 * r34010694;
        double r34010696 = 9.0;
        double r34010697 = r34010695 * r34010696;
        double r34010698 = r34010688 + r34010697;
        double r34010699 = 4.0;
        double r34010700 = t;
        double r34010701 = r34010700 / r34010685;
        double r34010702 = a;
        double r34010703 = r34010701 * r34010702;
        double r34010704 = r34010699 * r34010703;
        double r34010705 = r34010698 - r34010704;
        double r34010706 = 2.210437770349525e-37;
        bool r34010707 = r34010682 <= r34010706;
        double r34010708 = r34010682 / r34010686;
        double r34010709 = r34010690 * r34010689;
        double r34010710 = r34010709 / r34010686;
        double r34010711 = r34010696 * r34010710;
        double r34010712 = r34010708 + r34010711;
        double r34010713 = r34010699 * r34010700;
        double r34010714 = r34010713 * r34010702;
        double r34010715 = r34010712 - r34010714;
        double r34010716 = r34010715 / r34010685;
        double r34010717 = r34010687 / r34010690;
        double r34010718 = r34010717 / r34010689;
        double r34010719 = r34010693 / r34010718;
        double r34010720 = r34010696 * r34010719;
        double r34010721 = r34010720 + r34010688;
        double r34010722 = r34010721 - r34010704;
        double r34010723 = r34010707 ? r34010716 : r34010722;
        double r34010724 = r34010684 ? r34010705 : r34010723;
        return r34010724;
}

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

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original19.4
Target13.7
Herbie9.0
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -1.100156740804105 \cdot 10^{-171}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(z \cdot 4.0\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -0.0:\\ \;\;\;\;\frac{\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z}}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.1708877911747488 \cdot 10^{-53}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(z \cdot 4.0\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 2.876823679546137 \cdot 10^{+130}:\\ \;\;\;\;\left(\left(9.0 \cdot \frac{y}{c}\right) \cdot \frac{x}{z} + \frac{b}{c \cdot z}\right) - 4.0 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.3838515042456319 \cdot 10^{+158}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(z \cdot 4.0\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\left(9.0 \cdot \left(\frac{y}{c \cdot z} \cdot x\right) + \frac{b}{c \cdot z}\right) - 4.0 \cdot \frac{a \cdot t}{c}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if b < -3.7234362224650237e-13

    1. Initial program 21.7

      \[\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Simplified15.5

      \[\leadsto \color{blue}{\frac{\frac{b + \left(x \cdot 9.0\right) \cdot y}{z} - \left(t \cdot 4.0\right) \cdot a}{c}}\]
    3. Taylor expanded around 0 12.4

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

      \[\leadsto \left(9.0 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \frac{a \cdot t}{\color{blue}{1 \cdot c}}\]
    6. Applied times-frac10.6

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

      \[\leadsto \left(9.0 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \left(\color{blue}{a} \cdot \frac{t}{c}\right)\]
    8. Using strategy rm
    9. Applied associate-/l*8.5

      \[\leadsto \left(9.0 \cdot \color{blue}{\frac{x}{\frac{z \cdot c}{y}}} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \left(a \cdot \frac{t}{c}\right)\]
    10. Using strategy rm
    11. Applied *-un-lft-identity8.5

      \[\leadsto \left(9.0 \cdot \frac{x}{\frac{z \cdot c}{\color{blue}{1 \cdot y}}} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \left(a \cdot \frac{t}{c}\right)\]
    12. Applied times-frac8.5

      \[\leadsto \left(9.0 \cdot \frac{x}{\color{blue}{\frac{z}{1} \cdot \frac{c}{y}}} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \left(a \cdot \frac{t}{c}\right)\]
    13. Applied *-un-lft-identity8.5

      \[\leadsto \left(9.0 \cdot \frac{\color{blue}{1 \cdot x}}{\frac{z}{1} \cdot \frac{c}{y}} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \left(a \cdot \frac{t}{c}\right)\]
    14. Applied times-frac9.5

      \[\leadsto \left(9.0 \cdot \color{blue}{\left(\frac{1}{\frac{z}{1}} \cdot \frac{x}{\frac{c}{y}}\right)} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \left(a \cdot \frac{t}{c}\right)\]
    15. Simplified9.5

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

    if -3.7234362224650237e-13 < b < 2.210437770349525e-37

    1. Initial program 17.6

      \[\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Simplified9.1

      \[\leadsto \color{blue}{\frac{\frac{b + \left(x \cdot 9.0\right) \cdot y}{z} - \left(t \cdot 4.0\right) \cdot a}{c}}\]
    3. Taylor expanded around 0 9.0

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

    if 2.210437770349525e-37 < b

    1. Initial program 20.7

      \[\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Simplified15.0

      \[\leadsto \color{blue}{\frac{\frac{b + \left(x \cdot 9.0\right) \cdot y}{z} - \left(t \cdot 4.0\right) \cdot a}{c}}\]
    3. Taylor expanded around 0 12.1

      \[\leadsto \color{blue}{\left(9.0 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \frac{a \cdot t}{c}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity12.1

      \[\leadsto \left(9.0 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \frac{a \cdot t}{\color{blue}{1 \cdot c}}\]
    6. Applied times-frac10.6

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

      \[\leadsto \left(9.0 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \left(\color{blue}{a} \cdot \frac{t}{c}\right)\]
    8. Using strategy rm
    9. Applied associate-/l*8.6

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

      \[\leadsto \left(9.0 \cdot \color{blue}{\frac{1}{\frac{\frac{z \cdot c}{y}}{x}}} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \left(a \cdot \frac{t}{c}\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification9.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -3.7234362224650237 \cdot 10^{-13}:\\ \;\;\;\;\left(\frac{b}{c \cdot z} + \left(\frac{x}{\frac{c}{y}} \cdot \frac{1}{z}\right) \cdot 9.0\right) - 4.0 \cdot \left(\frac{t}{c} \cdot a\right)\\ \mathbf{elif}\;b \le 2.210437770349525 \cdot 10^{-37}:\\ \;\;\;\;\frac{\left(\frac{b}{z} + 9.0 \cdot \frac{y \cdot x}{z}\right) - \left(4.0 \cdot t\right) \cdot a}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(9.0 \cdot \frac{1}{\frac{\frac{c \cdot z}{y}}{x}} + \frac{b}{c \cdot z}\right) - 4.0 \cdot \left(\frac{t}{c} \cdot a\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019162 
(FPCore (x y z t a b c)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, J"

  :herbie-target
  (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) -1.100156740804105e-171) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) -0.0) (/ (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) z) c) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 1.1708877911747488e-53) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 2.876823679546137e+130) (- (+ (* (* 9.0 (/ y c)) (/ x z)) (/ b (* c z))) (* 4.0 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 1.3838515042456319e+158) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (- (+ (* 9.0 (* (/ y (* c z)) x)) (/ b (* c z))) (* 4.0 (/ (* a t) c))))))))

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