Average Error: 28.7 → 8.6
Time: 39.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(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le 0.2840264767838482:\\ \;\;\;\;\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{1}{\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 \left(\frac{-9}{2} \cdot \left(\sqrt{\frac{1}{3}} \cdot c\right)\right)\\ \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 0.2840264767838482:\\
\;\;\;\;\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{1}{\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 \left(\frac{-9}{2} \cdot \left(\sqrt{\frac{1}{3}} \cdot c\right)\right)\\

\end{array}
double f(double a, double b, double c) {
        double r2780790 = b;
        double r2780791 = -r2780790;
        double r2780792 = r2780790 * r2780790;
        double r2780793 = 3.0;
        double r2780794 = a;
        double r2780795 = r2780793 * r2780794;
        double r2780796 = c;
        double r2780797 = r2780795 * r2780796;
        double r2780798 = r2780792 - r2780797;
        double r2780799 = sqrt(r2780798);
        double r2780800 = r2780791 + r2780799;
        double r2780801 = r2780800 / r2780795;
        return r2780801;
}

double f(double a, double b, double c) {
        double r2780802 = b;
        double r2780803 = 0.2840264767838482;
        bool r2780804 = r2780802 <= r2780803;
        double r2780805 = -3.0;
        double r2780806 = a;
        double r2780807 = c;
        double r2780808 = r2780806 * r2780807;
        double r2780809 = r2780802 * r2780802;
        double r2780810 = fma(r2780805, r2780808, r2780809);
        double r2780811 = 1.5;
        double r2780812 = pow(r2780810, r2780811);
        double r2780813 = r2780809 * r2780802;
        double r2780814 = r2780812 - r2780813;
        double r2780815 = sqrt(r2780810);
        double r2780816 = r2780809 + r2780810;
        double r2780817 = fma(r2780802, r2780815, r2780816);
        double r2780818 = r2780814 / r2780817;
        double r2780819 = 3.0;
        double r2780820 = r2780806 * r2780819;
        double r2780821 = r2780818 / r2780820;
        double r2780822 = 1.0;
        double r2780823 = sqrt(r2780817);
        double r2780824 = r2780822 / r2780823;
        double r2780825 = r2780824 / r2780819;
        double r2780826 = -4.5;
        double r2780827 = 0.3333333333333333;
        double r2780828 = sqrt(r2780827);
        double r2780829 = r2780828 * r2780807;
        double r2780830 = r2780826 * r2780829;
        double r2780831 = r2780825 * r2780830;
        double r2780832 = r2780804 ? r2780821 : r2780831;
        return r2780832;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

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

    1. Initial program 10.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Simplified10.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--10.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. Simplified10.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. Simplified10.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(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 pow1/210.1

      \[\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)}^{\frac{1}{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}\]
    9. Applied pow110.1

      \[\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)}^{\frac{1}{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}\]
    10. Applied pow-prod-up10.0

      \[\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}\]
    11. Simplified10.0

      \[\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 0.2840264767838482 < b

    1. Initial program 31.2

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

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

      \[\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. Simplified30.6

      \[\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. Simplified30.6

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

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

      \[\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 *-un-lft-identity30.0

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot \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)} \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}\]
    12. Applied times-frac30.0

      \[\leadsto \frac{\color{blue}{\frac{1}{\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 \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)}}}}{3 \cdot a}\]
    13. Applied times-frac30.0

      \[\leadsto \color{blue}{\frac{\frac{1}{\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 \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)}}}{a}}\]
    14. Taylor expanded around 0 8.4

      \[\leadsto \frac{\frac{1}{\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 \color{blue}{\left(\frac{-9}{2} \cdot \left(\sqrt{\frac{1}{3}} \cdot c\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 0.2840264767838482:\\ \;\;\;\;\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{1}{\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 \left(\frac{-9}{2} \cdot \left(\sqrt{\frac{1}{3}} \cdot c\right)\right)\\ \end{array}\]

Reproduce

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