Average Error: 34.4 → 6.7
Time: 6.0s
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 -5.5038627888747993 \cdot 10^{151}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.10735029247724072 \cdot 10^{-236}:\\ \;\;\;\;1 \cdot \left(\frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot c\right)\\ \mathbf{elif}\;b_2 \le 5.43153376685683538 \cdot 10^{106}:\\ \;\;\;\;\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 -5.5038627888747993 \cdot 10^{151}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

\mathbf{elif}\;b_2 \le 5.43153376685683538 \cdot 10^{106}:\\
\;\;\;\;\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 r86624 = b_2;
        double r86625 = -r86624;
        double r86626 = r86624 * r86624;
        double r86627 = a;
        double r86628 = c;
        double r86629 = r86627 * r86628;
        double r86630 = r86626 - r86629;
        double r86631 = sqrt(r86630);
        double r86632 = r86625 - r86631;
        double r86633 = r86632 / r86627;
        return r86633;
}

double f(double a, double b_2, double c) {
        double r86634 = b_2;
        double r86635 = -5.503862788874799e+151;
        bool r86636 = r86634 <= r86635;
        double r86637 = -0.5;
        double r86638 = c;
        double r86639 = r86638 / r86634;
        double r86640 = r86637 * r86639;
        double r86641 = 1.1073502924772407e-236;
        bool r86642 = r86634 <= r86641;
        double r86643 = 1.0;
        double r86644 = r86634 * r86634;
        double r86645 = a;
        double r86646 = r86645 * r86638;
        double r86647 = r86644 - r86646;
        double r86648 = sqrt(r86647);
        double r86649 = r86648 - r86634;
        double r86650 = r86643 / r86649;
        double r86651 = r86650 * r86638;
        double r86652 = r86643 * r86651;
        double r86653 = 5.431533766856835e+106;
        bool r86654 = r86634 <= r86653;
        double r86655 = -r86634;
        double r86656 = r86655 - r86648;
        double r86657 = r86645 / r86656;
        double r86658 = r86643 / r86657;
        double r86659 = 0.5;
        double r86660 = r86659 * r86639;
        double r86661 = 2.0;
        double r86662 = r86634 / r86645;
        double r86663 = r86661 * r86662;
        double r86664 = r86660 - r86663;
        double r86665 = r86654 ? r86658 : r86664;
        double r86666 = r86642 ? r86652 : r86665;
        double r86667 = r86636 ? r86640 : r86666;
        return r86667;
}

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 < -5.503862788874799e+151

    1. Initial program 63.7

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

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

    if -5.503862788874799e+151 < b_2 < 1.1073502924772407e-236

    1. Initial program 32.5

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

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

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

      \[\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 associate-/r*16.2

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

      \[\leadsto \frac{\color{blue}{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}}{a}\]
    10. Using strategy rm
    11. Applied div-inv14.2

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \frac{a}{\frac{1}{c}}}}{a}\]
    14. Applied associate-/l*14.9

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

      \[\leadsto \frac{\frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\color{blue}{\frac{1}{c}}}\]
    16. Using strategy rm
    17. Applied *-un-lft-identity8.8

      \[\leadsto \frac{\frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\frac{1}{\color{blue}{1 \cdot c}}}\]
    18. Applied add-sqr-sqrt8.8

      \[\leadsto \frac{\frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{1 \cdot c}}\]
    19. Applied times-frac8.8

      \[\leadsto \frac{\frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\color{blue}{\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{1}}{c}}}\]
    20. Applied *-un-lft-identity8.8

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

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

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{1}}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{1}}{c}}\]
    23. Applied times-frac8.8

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

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

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

    if 1.1073502924772407e-236 < b_2 < 5.431533766856835e+106

    1. Initial program 8.6

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

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

    if 5.431533766856835e+106 < b_2

    1. Initial program 50.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -5.5038627888747993 \cdot 10^{151}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.10735029247724072 \cdot 10^{-236}:\\ \;\;\;\;1 \cdot \left(\frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot c\right)\\ \mathbf{elif}\;b_2 \le 5.43153376685683538 \cdot 10^{106}:\\ \;\;\;\;\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 2020062 
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))