Average Error: 19.9 → 9.1
Time: 6.0s
Precision: 64
\[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
\[\begin{array}{l} \mathbf{if}\;c \le -8.01606435075558813489187819433172994699 \cdot 10^{167}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;c \le -1.25232533826570190028460405815393000044 \cdot 10^{-129}:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;c \le 1.547180538999592702055798035495357086745 \cdot 10^{-144}:\\ \;\;\;\;\frac{\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z}}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \end{array}\]
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\begin{array}{l}
\mathbf{if}\;c \le -8.01606435075558813489187819433172994699 \cdot 10^{167}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\

\mathbf{elif}\;c \le -1.25232533826570190028460405815393000044 \cdot 10^{-129}:\\
\;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\

\mathbf{elif}\;c \le 1.547180538999592702055798035495357086745 \cdot 10^{-144}:\\
\;\;\;\;\frac{\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z}}{c}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r605785 = x;
        double r605786 = 9.0;
        double r605787 = r605785 * r605786;
        double r605788 = y;
        double r605789 = r605787 * r605788;
        double r605790 = z;
        double r605791 = 4.0;
        double r605792 = r605790 * r605791;
        double r605793 = t;
        double r605794 = r605792 * r605793;
        double r605795 = a;
        double r605796 = r605794 * r605795;
        double r605797 = r605789 - r605796;
        double r605798 = b;
        double r605799 = r605797 + r605798;
        double r605800 = c;
        double r605801 = r605790 * r605800;
        double r605802 = r605799 / r605801;
        return r605802;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r605803 = c;
        double r605804 = -8.016064350755588e+167;
        bool r605805 = r605803 <= r605804;
        double r605806 = b;
        double r605807 = z;
        double r605808 = r605807 * r605803;
        double r605809 = r605806 / r605808;
        double r605810 = 9.0;
        double r605811 = x;
        double r605812 = y;
        double r605813 = r605812 / r605803;
        double r605814 = r605807 / r605813;
        double r605815 = r605811 / r605814;
        double r605816 = r605810 * r605815;
        double r605817 = r605809 + r605816;
        double r605818 = 4.0;
        double r605819 = a;
        double r605820 = t;
        double r605821 = r605803 / r605820;
        double r605822 = r605819 / r605821;
        double r605823 = r605818 * r605822;
        double r605824 = r605817 - r605823;
        double r605825 = -1.2523253382657019e-129;
        bool r605826 = r605803 <= r605825;
        double r605827 = r605806 / r605807;
        double r605828 = r605827 / r605803;
        double r605829 = r605808 / r605812;
        double r605830 = r605811 / r605829;
        double r605831 = r605810 * r605830;
        double r605832 = r605828 + r605831;
        double r605833 = r605832 - r605823;
        double r605834 = 1.5471805389995927e-144;
        bool r605835 = r605803 <= r605834;
        double r605836 = r605811 * r605810;
        double r605837 = r605836 * r605812;
        double r605838 = r605807 * r605818;
        double r605839 = r605838 * r605820;
        double r605840 = r605839 * r605819;
        double r605841 = r605837 - r605840;
        double r605842 = r605841 + r605806;
        double r605843 = r605842 / r605807;
        double r605844 = r605843 / r605803;
        double r605845 = r605835 ? r605844 : r605824;
        double r605846 = r605826 ? r605833 : r605845;
        double r605847 = r605805 ? r605824 : r605846;
        return r605847;
}

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.9
Target15.0
Herbie9.1
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -1.100156740804105117061698089246936481893 \cdot 10^{-171}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -0.0:\\ \;\;\;\;\frac{\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z}}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.170887791174748819600820354912645756062 \cdot 10^{-53}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 2.876823679546137226963937101710277849382 \cdot 10^{130}:\\ \;\;\;\;\left(\left(9 \cdot \frac{y}{c}\right) \cdot \frac{x}{z} + \frac{b}{c \cdot z}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.383851504245631860711731716196098366993 \cdot 10^{158}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\left(9 \cdot \left(\frac{y}{c \cdot z} \cdot x\right) + \frac{b}{c \cdot z}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if c < -8.016064350755588e+167 or 1.5471805389995927e-144 < c

    1. Initial program 22.4

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Taylor expanded around 0 14.4

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

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

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

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

    if -8.016064350755588e+167 < c < -1.2523253382657019e-129

    1. Initial program 16.3

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Taylor expanded around 0 7.8

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

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

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

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

    if -1.2523253382657019e-129 < c < 1.5471805389995927e-144

    1. Initial program 15.0

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Using strategy rm
    3. Applied associate-/r*11.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \le -8.01606435075558813489187819433172994699 \cdot 10^{167}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;c \le -1.25232533826570190028460405815393000044 \cdot 10^{-129}:\\ \;\;\;\;\left(\frac{\frac{b}{z}}{c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;c \le 1.547180538999592702055798035495357086745 \cdot 10^{-144}:\\ \;\;\;\;\frac{\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z}}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z}{\frac{y}{c}}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \end{array}\]

Reproduce

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

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

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