Average Error: 28.7 → 27.4
Time: 39.4s
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(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \left(-b\right) \cdot \left(b \cdot b\right)\right)}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, b, b \cdot b\right) + \left(\sqrt[3]{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} \cdot \sqrt[3]{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}}{3 \cdot a}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \left(-b\right) \cdot \left(b \cdot b\right)\right)}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, b, b \cdot b\right) + \left(\sqrt[3]{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} \cdot \sqrt[3]{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}}{3 \cdot a}
double f(double a, double b, double c) {
        double r3005121 = b;
        double r3005122 = -r3005121;
        double r3005123 = r3005121 * r3005121;
        double r3005124 = 3.0;
        double r3005125 = a;
        double r3005126 = r3005124 * r3005125;
        double r3005127 = c;
        double r3005128 = r3005126 * r3005127;
        double r3005129 = r3005123 - r3005128;
        double r3005130 = sqrt(r3005129);
        double r3005131 = r3005122 + r3005130;
        double r3005132 = r3005131 / r3005126;
        return r3005132;
}

double f(double a, double b, double c) {
        double r3005133 = -3.0;
        double r3005134 = c;
        double r3005135 = a;
        double r3005136 = r3005134 * r3005135;
        double r3005137 = b;
        double r3005138 = r3005137 * r3005137;
        double r3005139 = fma(r3005133, r3005136, r3005138);
        double r3005140 = sqrt(r3005139);
        double r3005141 = -r3005137;
        double r3005142 = r3005141 * r3005138;
        double r3005143 = fma(r3005139, r3005140, r3005142);
        double r3005144 = fma(r3005140, r3005137, r3005138);
        double r3005145 = cbrt(r3005139);
        double r3005146 = r3005145 * r3005145;
        double r3005147 = r3005146 * r3005145;
        double r3005148 = r3005144 + r3005147;
        double r3005149 = r3005143 / r3005148;
        double r3005150 = 3.0;
        double r3005151 = r3005150 * r3005135;
        double r3005152 = r3005149 / r3005151;
        return r3005152;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 28.7

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

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

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

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

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

    \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right), \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, -\left(b \cdot b\right) \cdot b\right)}}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b, b \cdot b\right) + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}}{3 \cdot a}\]
  9. Using strategy rm
  10. Applied add-cube-cbrt27.4

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

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

Reproduce

herbie shell --seed 2019143 +o rules:numerics
(FPCore (a b c)
  :name "Cubic critical, 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) (* (* 3 a) c)))) (* 3 a)))