Average Error: 20.4 → 9.3
Time: 19.7s
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}\;x \cdot 9 \le -9.995353752836129015907503946636322850416 \cdot 10^{-196}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z \cdot c} \cdot y\right)\right) - 4 \cdot \frac{t}{\frac{c}{a}}\\ \mathbf{elif}\;x \cdot 9 \le 3.899422569231016937664074882654282192395 \cdot 10^{-69}:\\ \;\;\;\;\frac{\frac{b + x \cdot \left(9 \cdot y\right)}{z} - \left(a \cdot 4\right) \cdot t}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{\frac{t}{c}}{\frac{1}{a}}\\ \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}\;x \cdot 9 \le -9.995353752836129015907503946636322850416 \cdot 10^{-196}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z \cdot c} \cdot y\right)\right) - 4 \cdot \frac{t}{\frac{c}{a}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r96781 = x;
        double r96782 = 9.0;
        double r96783 = r96781 * r96782;
        double r96784 = y;
        double r96785 = r96783 * r96784;
        double r96786 = z;
        double r96787 = 4.0;
        double r96788 = r96786 * r96787;
        double r96789 = t;
        double r96790 = r96788 * r96789;
        double r96791 = a;
        double r96792 = r96790 * r96791;
        double r96793 = r96785 - r96792;
        double r96794 = b;
        double r96795 = r96793 + r96794;
        double r96796 = c;
        double r96797 = r96786 * r96796;
        double r96798 = r96795 / r96797;
        return r96798;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r96799 = x;
        double r96800 = 9.0;
        double r96801 = r96799 * r96800;
        double r96802 = -9.995353752836129e-196;
        bool r96803 = r96801 <= r96802;
        double r96804 = b;
        double r96805 = z;
        double r96806 = c;
        double r96807 = r96805 * r96806;
        double r96808 = r96804 / r96807;
        double r96809 = r96799 / r96807;
        double r96810 = y;
        double r96811 = r96809 * r96810;
        double r96812 = r96800 * r96811;
        double r96813 = r96808 + r96812;
        double r96814 = 4.0;
        double r96815 = t;
        double r96816 = a;
        double r96817 = r96806 / r96816;
        double r96818 = r96815 / r96817;
        double r96819 = r96814 * r96818;
        double r96820 = r96813 - r96819;
        double r96821 = 3.899422569231017e-69;
        bool r96822 = r96801 <= r96821;
        double r96823 = r96800 * r96810;
        double r96824 = r96799 * r96823;
        double r96825 = r96804 + r96824;
        double r96826 = r96825 / r96805;
        double r96827 = r96816 * r96814;
        double r96828 = r96827 * r96815;
        double r96829 = r96826 - r96828;
        double r96830 = r96829 / r96806;
        double r96831 = r96807 / r96810;
        double r96832 = r96799 / r96831;
        double r96833 = r96800 * r96832;
        double r96834 = r96808 + r96833;
        double r96835 = r96815 / r96806;
        double r96836 = 1.0;
        double r96837 = r96836 / r96816;
        double r96838 = r96835 / r96837;
        double r96839 = r96814 * r96838;
        double r96840 = r96834 - r96839;
        double r96841 = r96822 ? r96830 : r96840;
        double r96842 = r96803 ? r96820 : r96841;
        return r96842;
}

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

Original20.4
Target14.4
Herbie9.3
\[\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.100156740804104887233830094663413900721 \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 (* x 9.0) < -9.995353752836129e-196

    1. Initial program 21.1

      \[\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. Simplified15.0

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

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

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

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

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

    if -9.995353752836129e-196 < (* x 9.0) < 3.899422569231017e-69

    1. Initial program 16.9

      \[\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. Simplified7.5

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

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

    if 3.899422569231017e-69 < (* x 9.0)

    1. Initial program 23.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. Simplified17.5

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

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

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

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \color{blue}{\frac{x}{\frac{z \cdot c}{y}}}\right) - 4 \cdot \frac{t}{\frac{c}{a}}\]
    8. Using strategy rm
    9. Applied div-inv10.2

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{t}{\color{blue}{c \cdot \frac{1}{a}}}\]
    10. Applied associate-/r*9.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot 9 \le -9.995353752836129015907503946636322850416 \cdot 10^{-196}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z \cdot c} \cdot y\right)\right) - 4 \cdot \frac{t}{\frac{c}{a}}\\ \mathbf{elif}\;x \cdot 9 \le 3.899422569231016937664074882654282192395 \cdot 10^{-69}:\\ \;\;\;\;\frac{\frac{b + x \cdot \left(9 \cdot y\right)}{z} - \left(a \cdot 4\right) \cdot t}{c}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4 \cdot \frac{\frac{t}{c}}{\frac{1}{a}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019310 
(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.1001567408041049e-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.17088779117474882e-53) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 2.8768236795461372e130) (- (+ (* (* 9 (/ y c)) (/ x z)) (/ b (* c z))) (* 4 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 1.3838515042456319e158) (/ (+ (- (* (* 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)))