Average Error: 20.6 → 6.0
Time: 27.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}\;\left(x \cdot 9\right) \cdot y \le -6.586744535994701339987530143610558459178 \cdot 10^{278}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + \frac{y}{c} \cdot \left(\frac{x}{z} \cdot 9\right)\right) - 4 \cdot \frac{t \cdot a}{c}\\ \mathbf{elif}\;\left(x \cdot 9\right) \cdot y \le 8.599275020915485154882100787693294010321 \cdot 10^{246}:\\ \;\;\;\;\left(9 \cdot \frac{y \cdot x}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4 \cdot \left(\left(\frac{a}{\sqrt[3]{c}} \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\right) \cdot \frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\sqrt[3]{c}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + \frac{y}{c} \cdot \left(\frac{x}{z} \cdot 9\right)\right) - 4 \cdot \frac{t \cdot a}{c}\\ \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}\;\left(x \cdot 9\right) \cdot y \le -6.586744535994701339987530143610558459178 \cdot 10^{278}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + \frac{y}{c} \cdot \left(\frac{x}{z} \cdot 9\right)\right) - 4 \cdot \frac{t \cdot a}{c}\\

\mathbf{elif}\;\left(x \cdot 9\right) \cdot y \le 8.599275020915485154882100787693294010321 \cdot 10^{246}:\\
\;\;\;\;\left(9 \cdot \frac{y \cdot x}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4 \cdot \left(\left(\frac{a}{\sqrt[3]{c}} \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\right) \cdot \frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\sqrt[3]{c}}\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r29726191 = x;
        double r29726192 = 9.0;
        double r29726193 = r29726191 * r29726192;
        double r29726194 = y;
        double r29726195 = r29726193 * r29726194;
        double r29726196 = z;
        double r29726197 = 4.0;
        double r29726198 = r29726196 * r29726197;
        double r29726199 = t;
        double r29726200 = r29726198 * r29726199;
        double r29726201 = a;
        double r29726202 = r29726200 * r29726201;
        double r29726203 = r29726195 - r29726202;
        double r29726204 = b;
        double r29726205 = r29726203 + r29726204;
        double r29726206 = c;
        double r29726207 = r29726196 * r29726206;
        double r29726208 = r29726205 / r29726207;
        return r29726208;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r29726209 = x;
        double r29726210 = 9.0;
        double r29726211 = r29726209 * r29726210;
        double r29726212 = y;
        double r29726213 = r29726211 * r29726212;
        double r29726214 = -6.586744535994701e+278;
        bool r29726215 = r29726213 <= r29726214;
        double r29726216 = b;
        double r29726217 = z;
        double r29726218 = c;
        double r29726219 = r29726217 * r29726218;
        double r29726220 = r29726216 / r29726219;
        double r29726221 = r29726212 / r29726218;
        double r29726222 = r29726209 / r29726217;
        double r29726223 = r29726222 * r29726210;
        double r29726224 = r29726221 * r29726223;
        double r29726225 = r29726220 + r29726224;
        double r29726226 = 4.0;
        double r29726227 = t;
        double r29726228 = a;
        double r29726229 = r29726227 * r29726228;
        double r29726230 = r29726229 / r29726218;
        double r29726231 = r29726226 * r29726230;
        double r29726232 = r29726225 - r29726231;
        double r29726233 = 8.599275020915485e+246;
        bool r29726234 = r29726213 <= r29726233;
        double r29726235 = r29726212 * r29726209;
        double r29726236 = r29726235 / r29726219;
        double r29726237 = r29726210 * r29726236;
        double r29726238 = r29726237 + r29726220;
        double r29726239 = cbrt(r29726218);
        double r29726240 = r29726228 / r29726239;
        double r29726241 = cbrt(r29726227);
        double r29726242 = r29726241 / r29726239;
        double r29726243 = r29726240 * r29726242;
        double r29726244 = r29726241 * r29726241;
        double r29726245 = r29726244 / r29726239;
        double r29726246 = r29726243 * r29726245;
        double r29726247 = r29726226 * r29726246;
        double r29726248 = r29726238 - r29726247;
        double r29726249 = r29726234 ? r29726248 : r29726232;
        double r29726250 = r29726215 ? r29726232 : r29726249;
        return r29726250;
}

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.6
Target14.8
Herbie6.0
\[\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 2 regimes
  2. if (* (* x 9.0) y) < -6.586744535994701e+278 or 8.599275020915485e+246 < (* (* x 9.0) y)

    1. Initial program 52.7

      \[\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. Simplified49.7

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

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

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

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

    if -6.586744535994701e+278 < (* (* x 9.0) y) < 8.599275020915485e+246

    1. Initial program 17.2

      \[\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. Simplified9.7

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

      \[\leadsto \color{blue}{\left(9 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{c}}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt8.5

      \[\leadsto \left(9 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{\color{blue}{\left(\sqrt[3]{c} \cdot \sqrt[3]{c}\right) \cdot \sqrt[3]{c}}}\]
    6. Applied times-frac6.7

      \[\leadsto \left(9 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4 \cdot \color{blue}{\left(\frac{t}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{a}{\sqrt[3]{c}}\right)}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt6.8

      \[\leadsto \left(9 \cdot \frac{x \cdot y}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4 \cdot \left(\frac{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}}{\sqrt[3]{c} \cdot \sqrt[3]{c}} \cdot \frac{a}{\sqrt[3]{c}}\right)\]
    9. Applied times-frac6.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x \cdot 9\right) \cdot y \le -6.586744535994701339987530143610558459178 \cdot 10^{278}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + \frac{y}{c} \cdot \left(\frac{x}{z} \cdot 9\right)\right) - 4 \cdot \frac{t \cdot a}{c}\\ \mathbf{elif}\;\left(x \cdot 9\right) \cdot y \le 8.599275020915485154882100787693294010321 \cdot 10^{246}:\\ \;\;\;\;\left(9 \cdot \frac{y \cdot x}{z \cdot c} + \frac{b}{z \cdot c}\right) - 4 \cdot \left(\left(\frac{a}{\sqrt[3]{c}} \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{c}}\right) \cdot \frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\sqrt[3]{c}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + \frac{y}{c} \cdot \left(\frac{x}{z} \cdot 9\right)\right) - 4 \cdot \frac{t \cdot a}{c}\\ \end{array}\]

Reproduce

herbie shell --seed 2019171 +o rules:numerics
(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)))