Average Error: 28.8 → 0.3
Time: 3.2m
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{c}{(\left(\sqrt{b}\right) \cdot \left(-\sqrt{b}\right) + \left(-\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}\right))_*}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{c}{(\left(\sqrt{b}\right) \cdot \left(-\sqrt{b}\right) + \left(-\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}\right))_*}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r27647116 = b;
        double r27647117 = -r27647116;
        double r27647118 = r27647116 * r27647116;
        double r27647119 = 3.0;
        double r27647120 = a;
        double r27647121 = r27647119 * r27647120;
        double r27647122 = c;
        double r27647123 = r27647121 * r27647122;
        double r27647124 = r27647118 - r27647123;
        double r27647125 = sqrt(r27647124);
        double r27647126 = r27647117 + r27647125;
        double r27647127 = r27647126 / r27647121;
        return r27647127;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r27647128 = c;
        double r27647129 = b;
        double r27647130 = sqrt(r27647129);
        double r27647131 = -r27647130;
        double r27647132 = a;
        double r27647133 = -3.0;
        double r27647134 = r27647132 * r27647133;
        double r27647135 = r27647129 * r27647129;
        double r27647136 = fma(r27647134, r27647128, r27647135);
        double r27647137 = sqrt(r27647136);
        double r27647138 = -r27647137;
        double r27647139 = fma(r27647130, r27647131, r27647138);
        double r27647140 = r27647128 / r27647139;
        return r27647140;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Initial program 28.8

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

    \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
  4. Applied associate-/l/28.8

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

    \[\leadsto \frac{\color{blue}{3 \cdot \left(c \cdot a\right)}}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\]
  6. Using strategy rm
  7. Applied associate-*l*0.6

    \[\leadsto \frac{3 \cdot \left(c \cdot a\right)}{\color{blue}{3 \cdot \left(a \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)}}\]
  8. Using strategy rm
  9. Applied times-frac0.5

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

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

    \[\leadsto 1 \cdot \color{blue}{\frac{c}{\left(-b\right) - \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}}\]
  12. Using strategy rm
  13. Applied add-sqr-sqrt0.4

    \[\leadsto 1 \cdot \frac{c}{\left(-\color{blue}{\sqrt{b} \cdot \sqrt{b}}\right) - \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}\]
  14. Applied distribute-rgt-neg-in0.4

    \[\leadsto 1 \cdot \frac{c}{\color{blue}{\sqrt{b} \cdot \left(-\sqrt{b}\right)} - \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}\]
  15. Applied fma-neg0.3

    \[\leadsto 1 \cdot \frac{c}{\color{blue}{(\left(\sqrt{b}\right) \cdot \left(-\sqrt{b}\right) + \left(-\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}\right))_*}}\]
  16. Final simplification0.3

    \[\leadsto \frac{c}{(\left(\sqrt{b}\right) \cdot \left(-\sqrt{b}\right) + \left(-\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}\right))_*}\]

Reproduce

herbie shell --seed 2019119 +o rules:numerics
(FPCore (a b c d)
  :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)))