Average Error: 19.4 → 9.0
Time: 21.9s
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 r33151786 = x;
        double r33151787 = 9.0;
        double r33151788 = r33151786 * r33151787;
        double r33151789 = y;
        double r33151790 = r33151788 * r33151789;
        double r33151791 = z;
        double r33151792 = 4.0;
        double r33151793 = r33151791 * r33151792;
        double r33151794 = t;
        double r33151795 = r33151793 * r33151794;
        double r33151796 = a;
        double r33151797 = r33151795 * r33151796;
        double r33151798 = r33151790 - r33151797;
        double r33151799 = b;
        double r33151800 = r33151798 + r33151799;
        double r33151801 = c;
        double r33151802 = r33151791 * r33151801;
        double r33151803 = r33151800 / r33151802;
        return r33151803;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r33151804 = b;
        double r33151805 = -3.7234362224650237e-13;
        bool r33151806 = r33151804 <= r33151805;
        double r33151807 = c;
        double r33151808 = z;
        double r33151809 = r33151807 * r33151808;
        double r33151810 = r33151804 / r33151809;
        double r33151811 = x;
        double r33151812 = y;
        double r33151813 = r33151807 / r33151812;
        double r33151814 = r33151811 / r33151813;
        double r33151815 = 1.0;
        double r33151816 = r33151815 / r33151808;
        double r33151817 = r33151814 * r33151816;
        double r33151818 = 9.0;
        double r33151819 = r33151817 * r33151818;
        double r33151820 = r33151810 + r33151819;
        double r33151821 = 4.0;
        double r33151822 = t;
        double r33151823 = r33151822 / r33151807;
        double r33151824 = a;
        double r33151825 = r33151823 * r33151824;
        double r33151826 = r33151821 * r33151825;
        double r33151827 = r33151820 - r33151826;
        double r33151828 = 2.210437770349525e-37;
        bool r33151829 = r33151804 <= r33151828;
        double r33151830 = r33151804 / r33151808;
        double r33151831 = r33151812 * r33151811;
        double r33151832 = r33151831 / r33151808;
        double r33151833 = r33151818 * r33151832;
        double r33151834 = r33151830 + r33151833;
        double r33151835 = r33151821 * r33151822;
        double r33151836 = r33151835 * r33151824;
        double r33151837 = r33151834 - r33151836;
        double r33151838 = r33151837 / r33151807;
        double r33151839 = r33151809 / r33151812;
        double r33151840 = r33151839 / r33151811;
        double r33151841 = r33151815 / r33151840;
        double r33151842 = r33151818 * r33151841;
        double r33151843 = r33151842 + r33151810;
        double r33151844 = r33151843 - r33151826;
        double r33151845 = r33151829 ? r33151838 : r33151844;
        double r33151846 = r33151806 ? r33151827 : r33151845;
        return r33151846;
}

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)))