Average Error: 28.8 → 27.5
Time: 36.2s
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}\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{3}}{a}\right)\right) \cdot \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 \left(-b\right)\right)}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)} + b, \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{3}}{a}\right)\right) \cdot \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 \left(-b\right)\right)}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)} + b, \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}
double f(double a, double b, double c) {
        double r5114559 = b;
        double r5114560 = -r5114559;
        double r5114561 = r5114559 * r5114559;
        double r5114562 = 3.0;
        double r5114563 = a;
        double r5114564 = r5114562 * r5114563;
        double r5114565 = c;
        double r5114566 = r5114564 * r5114565;
        double r5114567 = r5114561 - r5114566;
        double r5114568 = sqrt(r5114567);
        double r5114569 = r5114560 + r5114568;
        double r5114570 = r5114569 / r5114564;
        return r5114570;
}

double f(double a, double b, double c) {
        double r5114571 = 0.3333333333333333;
        double r5114572 = a;
        double r5114573 = r5114571 / r5114572;
        double r5114574 = log1p(r5114573);
        double r5114575 = expm1(r5114574);
        double r5114576 = -3.0;
        double r5114577 = c;
        double r5114578 = r5114572 * r5114577;
        double r5114579 = b;
        double r5114580 = r5114579 * r5114579;
        double r5114581 = fma(r5114576, r5114578, r5114580);
        double r5114582 = sqrt(r5114581);
        double r5114583 = -r5114579;
        double r5114584 = r5114580 * r5114583;
        double r5114585 = fma(r5114581, r5114582, r5114584);
        double r5114586 = r5114582 + r5114579;
        double r5114587 = fma(r5114579, r5114586, r5114581);
        double r5114588 = r5114585 / r5114587;
        double r5114589 = r5114575 * r5114588;
        return r5114589;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

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. Simplified28.8

    \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, 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 \cdot a, c, b \cdot b\right)}\right)}^{3} - {b}^{3}}{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} + \left(b \cdot b + \sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} \cdot b\right)}}}{3 \cdot a}\]
  5. Simplified28.2

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

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

    \[\leadsto \frac{\frac{\color{blue}{\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)}, -b \cdot \left(b \cdot b\right)\right)}}{\mathsf{fma}\left(b, b + \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)\right)}}{3 \cdot a}\]
  9. Using strategy rm
  10. Applied div-inv27.5

    \[\leadsto \color{blue}{\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)}, -b \cdot \left(b \cdot b\right)\right)}{\mathsf{fma}\left(b, b + \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)\right)} \cdot \frac{1}{3 \cdot a}}\]
  11. Simplified27.5

    \[\leadsto \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)}, -b \cdot \left(b \cdot b\right)\right)}{\mathsf{fma}\left(b, b + \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)\right)} \cdot \color{blue}{\frac{\frac{1}{3}}{a}}\]
  12. Using strategy rm
  13. Applied expm1-log1p-u27.5

    \[\leadsto \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)}, -b \cdot \left(b \cdot b\right)\right)}{\mathsf{fma}\left(b, b + \sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}, \mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)\right)} \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{3}}{a}\right)\right)}\]
  14. Final simplification27.5

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{1}{3}}{a}\right)\right) \cdot \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 \left(-b\right)\right)}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)} + b, \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}\]

Reproduce

herbie shell --seed 2019163 +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)))