Average Error: 34.4 → 8.6
Time: 5.7s
Precision: 64
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -3.23769359395589062 \cdot 10^{66}:\\ \;\;\;\;\frac{\left(-b\right) + \left(1.5 \cdot \frac{a \cdot c}{b} - b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le -2.87410222399403687 \cdot 10^{-279}:\\ \;\;\;\;\frac{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 2445759453.4737968:\\ \;\;\;\;\frac{1}{1 \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le -3.23769359395589062 \cdot 10^{66}:\\
\;\;\;\;\frac{\left(-b\right) + \left(1.5 \cdot \frac{a \cdot c}{b} - b\right)}{3 \cdot a}\\

\mathbf{elif}\;b \le -2.87410222399403687 \cdot 10^{-279}:\\
\;\;\;\;\frac{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\

\mathbf{elif}\;b \le 2445759453.4737968:\\
\;\;\;\;\frac{1}{1 \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{c}}\\

\mathbf{else}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\

\end{array}
double f(double a, double b, double c) {
        double r171485 = b;
        double r171486 = -r171485;
        double r171487 = r171485 * r171485;
        double r171488 = 3.0;
        double r171489 = a;
        double r171490 = r171488 * r171489;
        double r171491 = c;
        double r171492 = r171490 * r171491;
        double r171493 = r171487 - r171492;
        double r171494 = sqrt(r171493);
        double r171495 = r171486 + r171494;
        double r171496 = r171495 / r171490;
        return r171496;
}

double f(double a, double b, double c) {
        double r171497 = b;
        double r171498 = -3.2376935939558906e+66;
        bool r171499 = r171497 <= r171498;
        double r171500 = -r171497;
        double r171501 = 1.5;
        double r171502 = a;
        double r171503 = c;
        double r171504 = r171502 * r171503;
        double r171505 = r171504 / r171497;
        double r171506 = r171501 * r171505;
        double r171507 = r171506 - r171497;
        double r171508 = r171500 + r171507;
        double r171509 = 3.0;
        double r171510 = r171509 * r171502;
        double r171511 = r171508 / r171510;
        double r171512 = -2.874102223994037e-279;
        bool r171513 = r171497 <= r171512;
        double r171514 = r171497 * r171497;
        double r171515 = r171510 * r171503;
        double r171516 = r171514 - r171515;
        double r171517 = sqrt(r171516);
        double r171518 = r171500 + r171517;
        double r171519 = sqrt(r171518);
        double r171520 = r171519 * r171519;
        double r171521 = r171520 / r171510;
        double r171522 = 2445759453.473797;
        bool r171523 = r171497 <= r171522;
        double r171524 = 1.0;
        double r171525 = r171500 - r171517;
        double r171526 = r171525 / r171503;
        double r171527 = r171524 * r171526;
        double r171528 = r171524 / r171527;
        double r171529 = -0.5;
        double r171530 = r171503 / r171497;
        double r171531 = r171529 * r171530;
        double r171532 = r171523 ? r171528 : r171531;
        double r171533 = r171513 ? r171521 : r171532;
        double r171534 = r171499 ? r171511 : r171533;
        return r171534;
}

Error

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

Derivation

  1. Split input into 4 regimes
  2. if b < -3.2376935939558906e+66

    1. Initial program 41.5

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Taylor expanded around -inf 10.4

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(1.5 \cdot \frac{a \cdot c}{b} - b\right)}}{3 \cdot a}\]

    if -3.2376935939558906e+66 < b < -2.874102223994037e-279

    1. Initial program 9.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt10.0

      \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]

    if -2.874102223994037e-279 < b < 2445759453.473797

    1. Initial program 25.5

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied flip-+25.5

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    4. Simplified17.7

      \[\leadsto \frac{\frac{\color{blue}{0 + 3 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied associate-/r*17.6

      \[\leadsto \color{blue}{\frac{\frac{\frac{0 + 3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3}}{a}}\]
    7. Simplified17.6

      \[\leadsto \frac{\color{blue}{\frac{3 \cdot \left(a \cdot c\right)}{3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}{a}\]
    8. Using strategy rm
    9. Applied clear-num17.7

      \[\leadsto \frac{\color{blue}{\frac{1}{\frac{3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{3 \cdot \left(a \cdot c\right)}}}}{a}\]
    10. Simplified17.6

      \[\leadsto \frac{\frac{1}{\color{blue}{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a \cdot c}}}}{a}\]
    11. Using strategy rm
    12. Applied *-un-lft-identity17.6

      \[\leadsto \frac{\frac{1}{\color{blue}{1 \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a \cdot c}}}}{a}\]
    13. Applied *-un-lft-identity17.6

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot 1}}{1 \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a \cdot c}}}{a}\]
    14. Applied times-frac17.6

      \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{1}{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a \cdot c}}}}{a}\]
    15. Applied associate-/l*17.7

      \[\leadsto \color{blue}{\frac{\frac{1}{1}}{\frac{a}{\frac{1}{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a \cdot c}}}}}\]
    16. Simplified10.9

      \[\leadsto \frac{\frac{1}{1}}{\color{blue}{1 \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{c}}}\]

    if 2445759453.473797 < b

    1. Initial program 56.2

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied flip-+56.2

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    4. Simplified26.9

      \[\leadsto \frac{\frac{\color{blue}{0 + 3 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied associate-/r*26.9

      \[\leadsto \color{blue}{\frac{\frac{\frac{0 + 3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3}}{a}}\]
    7. Simplified26.9

      \[\leadsto \frac{\color{blue}{\frac{3 \cdot \left(a \cdot c\right)}{3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}{a}\]
    8. Using strategy rm
    9. Applied clear-num27.0

      \[\leadsto \frac{\color{blue}{\frac{1}{\frac{3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{3 \cdot \left(a \cdot c\right)}}}}{a}\]
    10. Simplified27.0

      \[\leadsto \frac{\frac{1}{\color{blue}{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a \cdot c}}}}{a}\]
    11. Taylor expanded around inf 4.9

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification8.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -3.23769359395589062 \cdot 10^{66}:\\ \;\;\;\;\frac{\left(-b\right) + \left(1.5 \cdot \frac{a \cdot c}{b} - b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le -2.87410222399403687 \cdot 10^{-279}:\\ \;\;\;\;\frac{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 2445759453.4737968:\\ \;\;\;\;\frac{1}{1 \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2020059 
(FPCore (a b c)
  :name "Cubic critical"
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))