Average Error: 34.0 → 9.4
Time: 5.9s
Precision: 64
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -1.0366436397824178 \cdot 10^{68}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.75036677292823045 \cdot 10^{-219}:\\ \;\;\;\;\frac{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\frac{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}{a}\\ \mathbf{elif}\;b_2 \le 5.34931179548294658 \cdot 10^{30}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]
\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}
\mathbf{if}\;b_2 \le -1.0366436397824178 \cdot 10^{68}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le -2.75036677292823045 \cdot 10^{-219}:\\
\;\;\;\;\frac{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\frac{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}{a}\\

\mathbf{elif}\;b_2 \le 5.34931179548294658 \cdot 10^{30}:\\
\;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\

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

\end{array}
double f(double a, double b_2, double c) {
        double r69486 = b_2;
        double r69487 = -r69486;
        double r69488 = r69486 * r69486;
        double r69489 = a;
        double r69490 = c;
        double r69491 = r69489 * r69490;
        double r69492 = r69488 - r69491;
        double r69493 = sqrt(r69492);
        double r69494 = r69487 - r69493;
        double r69495 = r69494 / r69489;
        return r69495;
}

double f(double a, double b_2, double c) {
        double r69496 = b_2;
        double r69497 = -1.0366436397824178e+68;
        bool r69498 = r69496 <= r69497;
        double r69499 = -0.5;
        double r69500 = c;
        double r69501 = r69500 / r69496;
        double r69502 = r69499 * r69501;
        double r69503 = -2.7503667729282305e-219;
        bool r69504 = r69496 <= r69503;
        double r69505 = 1.0;
        double r69506 = r69496 * r69496;
        double r69507 = a;
        double r69508 = r69507 * r69500;
        double r69509 = r69506 - r69508;
        double r69510 = sqrt(r69509);
        double r69511 = r69510 - r69496;
        double r69512 = cbrt(r69511);
        double r69513 = r69512 * r69512;
        double r69514 = r69505 / r69513;
        double r69515 = r69512 / r69500;
        double r69516 = r69507 / r69515;
        double r69517 = r69514 * r69516;
        double r69518 = r69517 / r69507;
        double r69519 = 5.349311795482947e+30;
        bool r69520 = r69496 <= r69519;
        double r69521 = -r69496;
        double r69522 = r69521 - r69510;
        double r69523 = r69507 / r69522;
        double r69524 = r69505 / r69523;
        double r69525 = 0.5;
        double r69526 = r69525 * r69501;
        double r69527 = 2.0;
        double r69528 = r69496 / r69507;
        double r69529 = r69527 * r69528;
        double r69530 = r69526 - r69529;
        double r69531 = r69520 ? r69524 : r69530;
        double r69532 = r69504 ? r69518 : r69531;
        double r69533 = r69498 ? r69502 : r69532;
        return r69533;
}

Error

Bits error versus a

Bits error versus b_2

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_2 < -1.0366436397824178e+68

    1. Initial program 57.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 3.6

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b_2}}\]

    if -1.0366436397824178e+68 < b_2 < -2.7503667729282305e-219

    1. Initial program 34.6

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

      \[\leadsto \frac{\color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    4. Simplified16.9

      \[\leadsto \frac{\frac{\color{blue}{0 + a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Simplified16.9

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt17.6

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\left(\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\right) \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\]
    8. Applied *-un-lft-identity17.6

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

      \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{0 + a \cdot c}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\]
    10. Simplified16.9

      \[\leadsto \frac{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \color{blue}{\frac{a}{\frac{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}}{a}\]

    if -2.7503667729282305e-219 < b_2 < 5.349311795482947e+30

    1. Initial program 11.2

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num11.3

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

    if 5.349311795482947e+30 < b_2

    1. Initial program 35.5

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around inf 6.4

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification9.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.0366436397824178 \cdot 10^{68}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.75036677292823045 \cdot 10^{-219}:\\ \;\;\;\;\frac{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\frac{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}{a}\\ \mathbf{elif}\;b_2 \le 5.34931179548294658 \cdot 10^{30}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020049 
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))