Average Error: 34.2 → 6.8
Time: 4.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 -8.626773201174524 \cdot 10^{102}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -4.42774749682144966 \cdot 10^{-220}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{\frac{1}{c} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\\ \mathbf{elif}\;b_2 \le 1.6275304582996679 \cdot 10^{99}:\\ \;\;\;\;\frac{-b_2}{a} - \frac{\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 -8.626773201174524 \cdot 10^{102}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

\mathbf{elif}\;b_2 \le 1.6275304582996679 \cdot 10^{99}:\\
\;\;\;\;\frac{-b_2}{a} - \frac{\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 r14648 = b_2;
        double r14649 = -r14648;
        double r14650 = r14648 * r14648;
        double r14651 = a;
        double r14652 = c;
        double r14653 = r14651 * r14652;
        double r14654 = r14650 - r14653;
        double r14655 = sqrt(r14654);
        double r14656 = r14649 - r14655;
        double r14657 = r14656 / r14651;
        return r14657;
}

double f(double a, double b_2, double c) {
        double r14658 = b_2;
        double r14659 = -8.626773201174524e+102;
        bool r14660 = r14658 <= r14659;
        double r14661 = -0.5;
        double r14662 = c;
        double r14663 = r14662 / r14658;
        double r14664 = r14661 * r14663;
        double r14665 = -4.42774749682145e-220;
        bool r14666 = r14658 <= r14665;
        double r14667 = 1.0;
        double r14668 = r14658 * r14658;
        double r14669 = a;
        double r14670 = r14669 * r14662;
        double r14671 = r14668 - r14670;
        double r14672 = sqrt(r14671);
        double r14673 = r14672 - r14658;
        double r14674 = sqrt(r14673);
        double r14675 = r14667 / r14674;
        double r14676 = r14667 / r14662;
        double r14677 = r14676 * r14674;
        double r14678 = r14675 / r14677;
        double r14679 = 1.627530458299668e+99;
        bool r14680 = r14658 <= r14679;
        double r14681 = -r14658;
        double r14682 = r14681 / r14669;
        double r14683 = r14672 / r14669;
        double r14684 = r14682 - r14683;
        double r14685 = 0.5;
        double r14686 = r14685 * r14663;
        double r14687 = 2.0;
        double r14688 = r14658 / r14669;
        double r14689 = r14687 * r14688;
        double r14690 = r14686 - r14689;
        double r14691 = r14680 ? r14684 : r14690;
        double r14692 = r14666 ? r14678 : r14691;
        double r14693 = r14660 ? r14664 : r14692;
        return r14693;
}

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 < -8.626773201174524e+102

    1. Initial program 59.4

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

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

    if -8.626773201174524e+102 < b_2 < -4.42774749682145e-220

    1. Initial program 36.2

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--36.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. Simplified16.7

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

      \[\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-sqr-sqrt16.9

      \[\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}}}}{a}\]
    8. Applied *-un-lft-identity16.9

      \[\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}}}{a}\]
    9. Applied times-frac16.9

      \[\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}}}}{a}\]
    10. Applied associate-/l*16.3

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{\frac{a}{\frac{0 + a \cdot c}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}}\]
    11. Simplified15.7

      \[\leadsto \frac{\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{\color{blue}{\frac{a}{a \cdot c} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    12. Using strategy rm
    13. Applied clear-num15.6

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

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

    if -4.42774749682145e-220 < b_2 < 1.627530458299668e+99

    1. Initial program 10.3

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

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

    if 1.627530458299668e+99 < b_2

    1. Initial program 46.8

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

      \[\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 simplification6.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -8.626773201174524 \cdot 10^{102}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -4.42774749682144966 \cdot 10^{-220}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{\frac{1}{c} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\\ \mathbf{elif}\;b_2 \le 1.6275304582996679 \cdot 10^{99}:\\ \;\;\;\;\frac{-b_2}{a} - \frac{\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 2020060 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))