Average Error: 28.9 → 8.5
Time: 46.7s
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}\]
\[\begin{array}{l} \mathbf{if}\;b \le 1.816050980331357:\\ \;\;\;\;\frac{\frac{{\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}^{\frac{3}{2}} - \left(b \cdot b\right) \cdot b}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(\left(\sqrt{\frac{1}{3}} \cdot c\right) \cdot a\right) \cdot \frac{-9}{2}}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{a \cdot 3}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le 1.816050980331357:\\
\;\;\;\;\frac{\frac{{\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}^{\frac{3}{2}} - \left(b \cdot b\right) \cdot b}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(\left(\sqrt{\frac{1}{3}} \cdot c\right) \cdot a\right) \cdot \frac{-9}{2}}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{a \cdot 3}\\

\end{array}
double f(double a, double b, double c) {
        double r3567431 = b;
        double r3567432 = -r3567431;
        double r3567433 = r3567431 * r3567431;
        double r3567434 = 3.0;
        double r3567435 = a;
        double r3567436 = r3567434 * r3567435;
        double r3567437 = c;
        double r3567438 = r3567436 * r3567437;
        double r3567439 = r3567433 - r3567438;
        double r3567440 = sqrt(r3567439);
        double r3567441 = r3567432 + r3567440;
        double r3567442 = r3567441 / r3567436;
        return r3567442;
}

double f(double a, double b, double c) {
        double r3567443 = b;
        double r3567444 = 1.816050980331357;
        bool r3567445 = r3567443 <= r3567444;
        double r3567446 = -3.0;
        double r3567447 = a;
        double r3567448 = c;
        double r3567449 = r3567447 * r3567448;
        double r3567450 = r3567443 * r3567443;
        double r3567451 = fma(r3567446, r3567449, r3567450);
        double r3567452 = 1.5;
        double r3567453 = pow(r3567451, r3567452);
        double r3567454 = r3567450 * r3567443;
        double r3567455 = r3567453 - r3567454;
        double r3567456 = sqrt(r3567451);
        double r3567457 = r3567450 + r3567451;
        double r3567458 = fma(r3567443, r3567456, r3567457);
        double r3567459 = r3567455 / r3567458;
        double r3567460 = 3.0;
        double r3567461 = r3567447 * r3567460;
        double r3567462 = r3567459 / r3567461;
        double r3567463 = 0.3333333333333333;
        double r3567464 = sqrt(r3567463);
        double r3567465 = r3567464 * r3567448;
        double r3567466 = r3567465 * r3567447;
        double r3567467 = -4.5;
        double r3567468 = r3567466 * r3567467;
        double r3567469 = sqrt(r3567458);
        double r3567470 = r3567468 / r3567469;
        double r3567471 = r3567470 / r3567461;
        double r3567472 = r3567445 ? r3567462 : r3567471;
        return r3567472;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 2 regimes
  2. if b < 1.816050980331357

    1. Initial program 11.9

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

      \[\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--12.0

      \[\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. Simplified11.4

      \[\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. Simplified11.4

      \[\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(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{3 \cdot a}\]
    7. Using strategy rm
    8. Applied pow111.4

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

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

      \[\leadsto \frac{\frac{\color{blue}{{\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}^{1}} \cdot {\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}^{\left(\frac{1}{2}\right)} - \left(b \cdot b\right) \cdot b}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}{3 \cdot a}\]
    11. Applied pow-prod-up11.3

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

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

    if 1.816050980331357 < b

    1. Initial program 32.6

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

      \[\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--32.6

      \[\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. Simplified32.0

      \[\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. Simplified32.0

      \[\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(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{3 \cdot a}\]
    7. Using strategy rm
    8. Applied fma-neg31.3

      \[\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(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}{3 \cdot a}\]
    9. Using strategy rm
    10. Applied add-sqr-sqrt31.3

      \[\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)}{\color{blue}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}}{3 \cdot a}\]
    11. Applied associate-/r*31.3

      \[\leadsto \frac{\color{blue}{\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)}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}}{3 \cdot a}\]
    12. Taylor expanded around 0 7.9

      \[\leadsto \frac{\frac{\color{blue}{\frac{-9}{2} \cdot \left(a \cdot \left(\sqrt{\frac{1}{3}} \cdot c\right)\right)}}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{3 \cdot a}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 1.816050980331357:\\ \;\;\;\;\frac{\frac{{\left(\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}^{\frac{3}{2}} - \left(b \cdot b\right) \cdot b}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(\left(\sqrt{\frac{1}{3}} \cdot c\right) \cdot a\right) \cdot \frac{-9}{2}}{\sqrt{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}, b \cdot b + \mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)\right)}}}{a \cdot 3}\\ \end{array}\]

Reproduce

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