Average Error: 52.4 → 0.4
Time: 10.3s
Precision: 64
\[4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt a \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt b \lt 20282409603651670423947251286016 \land 4.930380657631323783823303533017413935458 \cdot 10^{-32} \lt c \lt 20282409603651670423947251286016\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{\left(4 \cdot c\right) \cdot a}{2 \cdot \left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right)}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\left(4 \cdot c\right) \cdot a}{2 \cdot \left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right)}
double f(double a, double b, double c) {
        double r41646 = b;
        double r41647 = -r41646;
        double r41648 = r41646 * r41646;
        double r41649 = 4.0;
        double r41650 = a;
        double r41651 = r41649 * r41650;
        double r41652 = c;
        double r41653 = r41651 * r41652;
        double r41654 = r41648 - r41653;
        double r41655 = sqrt(r41654);
        double r41656 = r41647 + r41655;
        double r41657 = 2.0;
        double r41658 = r41657 * r41650;
        double r41659 = r41656 / r41658;
        return r41659;
}

double f(double a, double b, double c) {
        double r41660 = 4.0;
        double r41661 = c;
        double r41662 = r41660 * r41661;
        double r41663 = a;
        double r41664 = r41662 * r41663;
        double r41665 = 2.0;
        double r41666 = b;
        double r41667 = -r41666;
        double r41668 = r41666 * r41666;
        double r41669 = r41660 * r41663;
        double r41670 = r41669 * r41661;
        double r41671 = r41668 - r41670;
        double r41672 = sqrt(r41671);
        double r41673 = r41667 - r41672;
        double r41674 = r41663 * r41673;
        double r41675 = r41665 * r41674;
        double r41676 = r41664 / r41675;
        return r41676;
}

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. Initial program 52.4

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
  2. Using strategy rm
  3. Applied flip-+52.4

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

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

    \[\leadsto \frac{\color{blue}{\left(0 + a \cdot \left(4 \cdot c\right)\right) \cdot \frac{1}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
  7. Applied associate-/l*0.4

    \[\leadsto \color{blue}{\frac{0 + a \cdot \left(4 \cdot c\right)}{\frac{2 \cdot a}{\frac{1}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}}\]
  8. Simplified0.4

    \[\leadsto \frac{0 + a \cdot \left(4 \cdot c\right)}{\color{blue}{2 \cdot \left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right)}}\]
  9. Final simplification0.4

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

Reproduce

herbie shell --seed 2019351 
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :precision binary64
  :pre (and (< 4.9303800000000003e-32 a 2.02824e+31) (< 4.9303800000000003e-32 b 2.02824e+31) (< 4.9303800000000003e-32 c 2.02824e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))