Average Error: 28.3 → 27.1
Time: 48.9s
Precision: 64
\[1.0536712127723509 \cdot 10^{-08} \lt a \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt b \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt c \lt 94906265.62425156\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{\frac{\frac{\sqrt[3]{\mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, b \cdot \left(b \cdot \left(-b\right)\right)\right) \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, b \cdot \left(b \cdot \left(-b\right)\right)\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, b \cdot \left(b \cdot \left(-b\right)\right)\right)\right)}}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)} + b, \mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)\right)\right)}}{a}}{2}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\frac{\frac{\sqrt[3]{\mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, b \cdot \left(b \cdot \left(-b\right)\right)\right) \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, b \cdot \left(b \cdot \left(-b\right)\right)\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, b \cdot \left(b \cdot \left(-b\right)\right)\right)\right)}}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)} + b, \mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)\right)\right)}}{a}}{2}
double f(double a, double b, double c) {
        double r1887652 = b;
        double r1887653 = -r1887652;
        double r1887654 = r1887652 * r1887652;
        double r1887655 = 4.0;
        double r1887656 = a;
        double r1887657 = r1887655 * r1887656;
        double r1887658 = c;
        double r1887659 = r1887657 * r1887658;
        double r1887660 = r1887654 - r1887659;
        double r1887661 = sqrt(r1887660);
        double r1887662 = r1887653 + r1887661;
        double r1887663 = 2.0;
        double r1887664 = r1887663 * r1887656;
        double r1887665 = r1887662 / r1887664;
        return r1887665;
}

double f(double a, double b, double c) {
        double r1887666 = -4.0;
        double r1887667 = a;
        double r1887668 = r1887666 * r1887667;
        double r1887669 = c;
        double r1887670 = b;
        double r1887671 = r1887670 * r1887670;
        double r1887672 = fma(r1887668, r1887669, r1887671);
        double r1887673 = sqrt(r1887672);
        double r1887674 = -r1887670;
        double r1887675 = r1887670 * r1887674;
        double r1887676 = r1887670 * r1887675;
        double r1887677 = fma(r1887672, r1887673, r1887676);
        double r1887678 = r1887677 * r1887677;
        double r1887679 = r1887677 * r1887678;
        double r1887680 = cbrt(r1887679);
        double r1887681 = r1887673 + r1887670;
        double r1887682 = log1p(r1887672);
        double r1887683 = expm1(r1887682);
        double r1887684 = fma(r1887670, r1887681, r1887683);
        double r1887685 = r1887680 / r1887684;
        double r1887686 = r1887685 / r1887667;
        double r1887687 = 2.0;
        double r1887688 = r1887686 / r1887687;
        return r1887688;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 28.3

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

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} - b}{a}}{2}}\]
  3. Using strategy rm
  4. Applied flip3--28.4

    \[\leadsto \frac{\frac{\color{blue}{\frac{{\left(\sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)}\right)}^{3} - {b}^{3}}{\sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} + \left(b \cdot b + \sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} \cdot b\right)}}}{a}}{2}\]
  5. Simplified27.6

    \[\leadsto \frac{\frac{\frac{\color{blue}{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)} - b \cdot \left(b \cdot b\right)}}{\sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} + \left(b \cdot b + \sqrt{\mathsf{fma}\left(c \cdot a, -4, b \cdot b\right)} \cdot b\right)}}{a}}{2}\]
  6. Simplified27.6

    \[\leadsto \frac{\frac{\frac{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)} - b \cdot \left(b \cdot b\right)}{\color{blue}{\mathsf{fma}\left(b, b + \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, \mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}}}{a}}{2}\]
  7. Using strategy rm
  8. Applied fma-neg27.0

    \[\leadsto \frac{\frac{\frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, -b \cdot \left(b \cdot b\right)\right)}}{\mathsf{fma}\left(b, b + \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, \mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)}}{a}}{2}\]
  9. Using strategy rm
  10. Applied expm1-log1p-u27.1

    \[\leadsto \frac{\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, -b \cdot \left(b \cdot b\right)\right)}{\mathsf{fma}\left(b, b + \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)\right)}\right)}}{a}}{2}\]
  11. Using strategy rm
  12. Applied add-cbrt-cube27.1

    \[\leadsto \frac{\frac{\frac{\color{blue}{\sqrt[3]{\left(\mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, -b \cdot \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, -b \cdot \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, -b \cdot \left(b \cdot b\right)\right)}}}{\mathsf{fma}\left(b, b + \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, \mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)\right)\right)}}{a}}{2}\]
  13. Final simplification27.1

    \[\leadsto \frac{\frac{\frac{\sqrt[3]{\mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, b \cdot \left(b \cdot \left(-b\right)\right)\right) \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, b \cdot \left(b \cdot \left(-b\right)\right)\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)}, b \cdot \left(b \cdot \left(-b\right)\right)\right)\right)}}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)} + b, \mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-4 \cdot a, c, b \cdot b\right)\right)\right)\right)}}{a}}{2}\]

Reproduce

herbie shell --seed 2019165 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))