Average Error: 33.8 → 10.3
Time: 23.4s
Precision: 64
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -2.025649824816678368861606895534923213042 \cdot 10^{153}:\\ \;\;\;\;\left(1 \cdot \frac{c}{b} - \frac{b}{a} \cdot 0.5\right) - \frac{\frac{b}{2}}{a}\\ \mathbf{elif}\;b \le 3.047677256636077515553757160900796353717 \cdot 10^{-81}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2}}{a} - \frac{\frac{b}{2}}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le -2.025649824816678368861606895534923213042 \cdot 10^{153}:\\
\;\;\;\;\left(1 \cdot \frac{c}{b} - \frac{b}{a} \cdot 0.5\right) - \frac{\frac{b}{2}}{a}\\

\mathbf{elif}\;b \le 3.047677256636077515553757160900796353717 \cdot 10^{-81}:\\
\;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2}}{a} - \frac{\frac{b}{2}}{a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r2625649 = b;
        double r2625650 = -r2625649;
        double r2625651 = r2625649 * r2625649;
        double r2625652 = 4.0;
        double r2625653 = a;
        double r2625654 = r2625652 * r2625653;
        double r2625655 = c;
        double r2625656 = r2625654 * r2625655;
        double r2625657 = r2625651 - r2625656;
        double r2625658 = sqrt(r2625657);
        double r2625659 = r2625650 + r2625658;
        double r2625660 = 2.0;
        double r2625661 = r2625660 * r2625653;
        double r2625662 = r2625659 / r2625661;
        return r2625662;
}

double f(double a, double b, double c) {
        double r2625663 = b;
        double r2625664 = -2.0256498248166784e+153;
        bool r2625665 = r2625663 <= r2625664;
        double r2625666 = 1.0;
        double r2625667 = c;
        double r2625668 = r2625667 / r2625663;
        double r2625669 = r2625666 * r2625668;
        double r2625670 = a;
        double r2625671 = r2625663 / r2625670;
        double r2625672 = 0.5;
        double r2625673 = r2625671 * r2625672;
        double r2625674 = r2625669 - r2625673;
        double r2625675 = 2.0;
        double r2625676 = r2625663 / r2625675;
        double r2625677 = r2625676 / r2625670;
        double r2625678 = r2625674 - r2625677;
        double r2625679 = 3.0476772566360775e-81;
        bool r2625680 = r2625663 <= r2625679;
        double r2625681 = r2625663 * r2625663;
        double r2625682 = r2625667 * r2625670;
        double r2625683 = 4.0;
        double r2625684 = r2625682 * r2625683;
        double r2625685 = r2625681 - r2625684;
        double r2625686 = sqrt(r2625685);
        double r2625687 = r2625686 / r2625675;
        double r2625688 = r2625687 / r2625670;
        double r2625689 = r2625688 - r2625677;
        double r2625690 = -1.0;
        double r2625691 = r2625690 * r2625668;
        double r2625692 = r2625680 ? r2625689 : r2625691;
        double r2625693 = r2625665 ? r2625678 : r2625692;
        return r2625693;
}

Error

Bits error versus a

Bits error versus b

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.0256498248166784e+153

    1. Initial program 63.6

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

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}{2}}{a}}\]
    3. Using strategy rm
    4. Applied div-sub63.6

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2} - \frac{b}{2}}}{a}\]
    5. Applied div-sub63.6

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2}}{a} - \frac{\frac{b}{2}}{a}}\]
    6. Taylor expanded around -inf 2.0

      \[\leadsto \color{blue}{\left(1 \cdot \frac{c}{b} - 0.5 \cdot \frac{b}{a}\right)} - \frac{\frac{b}{2}}{a}\]

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

    1. Initial program 11.9

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

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}{2}}{a}}\]
    3. Using strategy rm
    4. Applied div-sub11.9

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2} - \frac{b}{2}}}{a}\]
    5. Applied div-sub11.9

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2}}{a} - \frac{\frac{b}{2}}{a}}\]

    if 3.0476772566360775e-81 < b

    1. Initial program 52.2

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

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}{2}}{a}}\]
    3. Taylor expanded around inf 10.5

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.025649824816678368861606895534923213042 \cdot 10^{153}:\\ \;\;\;\;\left(1 \cdot \frac{c}{b} - \frac{b}{a} \cdot 0.5\right) - \frac{\frac{b}{2}}{a}\\ \mathbf{elif}\;b \le 3.047677256636077515553757160900796353717 \cdot 10^{-81}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2}}{a} - \frac{\frac{b}{2}}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2019179 
(FPCore (a b c)
  :name "Quadratic roots, full range"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))