Average Error: 34.2 → 6.8
Time: 4.3s
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 r64475 = b_2;
        double r64476 = -r64475;
        double r64477 = r64475 * r64475;
        double r64478 = a;
        double r64479 = c;
        double r64480 = r64478 * r64479;
        double r64481 = r64477 - r64480;
        double r64482 = sqrt(r64481);
        double r64483 = r64476 - r64482;
        double r64484 = r64483 / r64478;
        return r64484;
}

double f(double a, double b_2, double c) {
        double r64485 = b_2;
        double r64486 = -8.626773201174524e+102;
        bool r64487 = r64485 <= r64486;
        double r64488 = -0.5;
        double r64489 = c;
        double r64490 = r64489 / r64485;
        double r64491 = r64488 * r64490;
        double r64492 = -4.42774749682145e-220;
        bool r64493 = r64485 <= r64492;
        double r64494 = 1.0;
        double r64495 = r64485 * r64485;
        double r64496 = a;
        double r64497 = r64496 * r64489;
        double r64498 = r64495 - r64497;
        double r64499 = sqrt(r64498);
        double r64500 = r64499 - r64485;
        double r64501 = sqrt(r64500);
        double r64502 = r64494 / r64501;
        double r64503 = r64494 / r64489;
        double r64504 = r64503 * r64501;
        double r64505 = r64502 / r64504;
        double r64506 = 1.627530458299668e+99;
        bool r64507 = r64485 <= r64506;
        double r64508 = -r64485;
        double r64509 = r64508 / r64496;
        double r64510 = r64499 / r64496;
        double r64511 = r64509 - r64510;
        double r64512 = 0.5;
        double r64513 = r64512 * r64490;
        double r64514 = 2.0;
        double r64515 = r64485 / r64496;
        double r64516 = r64514 * r64515;
        double r64517 = r64513 - r64516;
        double r64518 = r64507 ? r64511 : r64517;
        double r64519 = r64493 ? r64505 : r64518;
        double r64520 = r64487 ? r64491 : r64519;
        return r64520;
}

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 "NMSE problem 3.2.1"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))