Average Error: 34.0 → 9.5
Time: 18.8s
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.113821654949688919486578053270333252641 \cdot 10^{81}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 9.282718576312558283749529381981667422729 \cdot 10^{-291}:\\ \;\;\;\;\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{\frac{a}{\sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}} \cdot \frac{c}{\sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\\ \mathbf{elif}\;b_2 \le 2098867031.934578418731689453125:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \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.113821654949688919486578053270333252641 \cdot 10^{81}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le 9.282718576312558283749529381981667422729 \cdot 10^{-291}:\\
\;\;\;\;\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{\frac{a}{\sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}} \cdot \frac{c}{\sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\\

\mathbf{elif}\;b_2 \le 2098867031.934578418731689453125:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\

\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 r34788 = b_2;
        double r34789 = -r34788;
        double r34790 = r34788 * r34788;
        double r34791 = a;
        double r34792 = c;
        double r34793 = r34791 * r34792;
        double r34794 = r34790 - r34793;
        double r34795 = sqrt(r34794);
        double r34796 = r34789 - r34795;
        double r34797 = r34796 / r34791;
        return r34797;
}

double f(double a, double b_2, double c) {
        double r34798 = b_2;
        double r34799 = -1.113821654949689e+81;
        bool r34800 = r34798 <= r34799;
        double r34801 = -0.5;
        double r34802 = c;
        double r34803 = r34802 / r34798;
        double r34804 = r34801 * r34803;
        double r34805 = 9.282718576312558e-291;
        bool r34806 = r34798 <= r34805;
        double r34807 = 1.0;
        double r34808 = r34798 * r34798;
        double r34809 = a;
        double r34810 = r34809 * r34802;
        double r34811 = r34808 - r34810;
        double r34812 = sqrt(r34811);
        double r34813 = r34812 - r34798;
        double r34814 = sqrt(r34813);
        double r34815 = r34807 / r34814;
        double r34816 = sqrt(r34814);
        double r34817 = r34809 / r34816;
        double r34818 = r34802 / r34816;
        double r34819 = r34817 * r34818;
        double r34820 = r34819 / r34809;
        double r34821 = r34815 * r34820;
        double r34822 = 2098867031.9345784;
        bool r34823 = r34798 <= r34822;
        double r34824 = -r34798;
        double r34825 = r34824 - r34812;
        double r34826 = r34825 / r34809;
        double r34827 = 0.5;
        double r34828 = r34827 * r34803;
        double r34829 = 2.0;
        double r34830 = r34798 / r34809;
        double r34831 = r34829 * r34830;
        double r34832 = r34828 - r34831;
        double r34833 = r34823 ? r34826 : r34832;
        double r34834 = r34806 ? r34821 : r34833;
        double r34835 = r34800 ? r34804 : r34834;
        return r34835;
}

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.113821654949689e+81

    1. Initial program 58.1

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

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

    if -1.113821654949689e+81 < b_2 < 9.282718576312558e-291

    1. Initial program 32.3

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

      \[\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. Simplified17.4

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

      \[\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 *-un-lft-identity17.4

      \[\leadsto \frac{\frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\color{blue}{1 \cdot a}}\]
    8. Applied add-sqr-sqrt17.6

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{1 \cdot a}\]
    9. Applied *-un-lft-identity17.6

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

      \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{0 + a \cdot c}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{1 \cdot a}\]
    11. Applied times-frac17.4

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{1} \cdot \frac{\frac{0 + a \cdot c}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}}\]
    12. Simplified17.4

      \[\leadsto \color{blue}{\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}} \cdot \frac{\frac{0 + a \cdot c}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    13. Simplified17.4

      \[\leadsto \frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \color{blue}{\frac{\frac{a \cdot c}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}}\]
    14. Using strategy rm
    15. Applied add-sqr-sqrt17.4

      \[\leadsto \frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{\frac{a \cdot c}{\sqrt{\color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}}{a}\]
    16. Applied sqrt-prod17.4

      \[\leadsto \frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{\frac{a \cdot c}{\color{blue}{\sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}}{a}\]
    17. Applied times-frac16.0

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

    if 9.282718576312558e-291 < b_2 < 2098867031.9345784

    1. Initial program 10.5

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

    if 2098867031.9345784 < b_2

    1. Initial program 32.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.113821654949688919486578053270333252641 \cdot 10^{81}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 9.282718576312558283749529381981667422729 \cdot 10^{-291}:\\ \;\;\;\;\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{\frac{a}{\sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}} \cdot \frac{c}{\sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\\ \mathbf{elif}\;b_2 \le 2098867031.934578418731689453125:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019209 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))