Average Error: 33.7 → 10.3
Time: 15.5s
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 -2.025649824816678368861606895534923213042 \cdot 10^{153}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{\frac{a}{2}}\\ \mathbf{elif}\;b_2 \le 3.047677256636077515553757160900796353717 \cdot 10^{-81}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \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 -2.025649824816678368861606895534923213042 \cdot 10^{153}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{\frac{a}{2}}\\

\mathbf{elif}\;b_2 \le 3.047677256636077515553757160900796353717 \cdot 10^{-81}:\\
\;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\

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

\end{array}
double f(double a, double b_2, double c) {
        double r23631 = b_2;
        double r23632 = -r23631;
        double r23633 = r23631 * r23631;
        double r23634 = a;
        double r23635 = c;
        double r23636 = r23634 * r23635;
        double r23637 = r23633 - r23636;
        double r23638 = sqrt(r23637);
        double r23639 = r23632 + r23638;
        double r23640 = r23639 / r23634;
        return r23640;
}

double f(double a, double b_2, double c) {
        double r23641 = b_2;
        double r23642 = -2.0256498248166784e+153;
        bool r23643 = r23641 <= r23642;
        double r23644 = 0.5;
        double r23645 = c;
        double r23646 = r23645 / r23641;
        double r23647 = r23644 * r23646;
        double r23648 = a;
        double r23649 = 2.0;
        double r23650 = r23648 / r23649;
        double r23651 = r23641 / r23650;
        double r23652 = r23647 - r23651;
        double r23653 = 3.0476772566360775e-81;
        bool r23654 = r23641 <= r23653;
        double r23655 = r23641 * r23641;
        double r23656 = r23648 * r23645;
        double r23657 = r23655 - r23656;
        double r23658 = sqrt(r23657);
        double r23659 = r23658 - r23641;
        double r23660 = r23659 / r23648;
        double r23661 = -0.5;
        double r23662 = r23661 * r23646;
        double r23663 = r23654 ? r23660 : r23662;
        double r23664 = r23643 ? r23652 : r23663;
        return r23664;
}

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 3 regimes
  2. if b_2 < -2.0256498248166784e+153

    1. Initial program 63.6

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified63.6

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Taylor expanded around -inf 2.0

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}}\]
    4. Simplified2.0

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

    if -2.0256498248166784e+153 < b_2 < 3.0476772566360775e-81

    1. Initial program 11.9

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified11.9

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Using strategy rm
    4. Applied clear-num12.0

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    5. Simplified12.0

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{\sqrt{{b_2}^{2} - a \cdot c} - b_2}}}\]
    6. Using strategy rm
    7. Applied div-inv12.1

      \[\leadsto \frac{1}{\color{blue}{a \cdot \frac{1}{\sqrt{{b_2}^{2} - a \cdot c} - b_2}}}\]
    8. Applied add-cube-cbrt12.1

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{a \cdot \frac{1}{\sqrt{{b_2}^{2} - a \cdot c} - b_2}}\]
    9. Applied times-frac12.1

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{a} \cdot \frac{\sqrt[3]{1}}{\frac{1}{\sqrt{{b_2}^{2} - a \cdot c} - b_2}}}\]
    10. Simplified12.1

      \[\leadsto \color{blue}{\frac{1}{a}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{\sqrt{{b_2}^{2} - a \cdot c} - b_2}}\]
    11. Simplified12.1

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)}\]
    12. Using strategy rm
    13. Applied *-un-lft-identity12.1

      \[\leadsto \frac{1}{\color{blue}{1 \cdot a}} \cdot \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)\]
    14. Applied add-sqr-sqrt12.1

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

      \[\leadsto \color{blue}{\left(\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{1}}{a}\right)} \cdot \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)\]
    16. Applied associate-*l*12.1

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

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

    if 3.0476772566360775e-81 < b_2

    1. Initial program 52.1

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified52.1

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Using strategy rm
    4. Applied clear-num52.2

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    5. Simplified52.2

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{\sqrt{{b_2}^{2} - a \cdot c} - b_2}}}\]
    6. Using strategy rm
    7. Applied div-inv52.2

      \[\leadsto \frac{1}{\color{blue}{a \cdot \frac{1}{\sqrt{{b_2}^{2} - a \cdot c} - b_2}}}\]
    8. Applied add-cube-cbrt52.2

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{a \cdot \frac{1}{\sqrt{{b_2}^{2} - a \cdot c} - b_2}}\]
    9. Applied times-frac52.2

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{a} \cdot \frac{\sqrt[3]{1}}{\frac{1}{\sqrt{{b_2}^{2} - a \cdot c} - b_2}}}\]
    10. Simplified52.2

      \[\leadsto \color{blue}{\frac{1}{a}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{\sqrt{{b_2}^{2} - a \cdot c} - b_2}}\]
    11. Simplified52.2

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)}\]
    12. Using strategy rm
    13. Applied *-un-lft-identity52.2

      \[\leadsto \frac{1}{\color{blue}{1 \cdot a}} \cdot \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)\]
    14. Applied add-sqr-sqrt52.2

      \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{1 \cdot a} \cdot \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)\]
    15. Applied times-frac52.2

      \[\leadsto \color{blue}{\left(\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{1}}{a}\right)} \cdot \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)\]
    16. Applied associate-*l*52.2

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

      \[\leadsto \frac{\sqrt{1}}{1} \cdot \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}{a}}\]
    18. Taylor expanded around inf 10.5

      \[\leadsto \frac{\sqrt{1}}{1} \cdot \color{blue}{\left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.025649824816678368861606895534923213042 \cdot 10^{153}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{\frac{a}{2}}\\ \mathbf{elif}\;b_2 \le 3.047677256636077515553757160900796353717 \cdot 10^{-81}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019179 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))