Average Error: 44.0 → 43.3
Time: 28.5s
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -3\right)}}, -b\right) \cdot \left(\left(\sqrt[3]{\frac{1}{3}} \cdot \sqrt[3]{\frac{1}{3}}\right) \cdot \frac{\sqrt[3]{\frac{1}{3}}}{a}\right)\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, a \cdot c, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -3\right)}}, -b\right) \cdot \left(\left(\sqrt[3]{\frac{1}{3}} \cdot \sqrt[3]{\frac{1}{3}}\right) \cdot \frac{\sqrt[3]{\frac{1}{3}}}{a}\right)
double f(double a, double b, double c) {
        double r4243795 = b;
        double r4243796 = -r4243795;
        double r4243797 = r4243795 * r4243795;
        double r4243798 = 3.0;
        double r4243799 = a;
        double r4243800 = r4243798 * r4243799;
        double r4243801 = c;
        double r4243802 = r4243800 * r4243801;
        double r4243803 = r4243797 - r4243802;
        double r4243804 = sqrt(r4243803);
        double r4243805 = r4243796 + r4243804;
        double r4243806 = r4243805 / r4243800;
        return r4243806;
}

double f(double a, double b, double c) {
        double r4243807 = -3.0;
        double r4243808 = a;
        double r4243809 = c;
        double r4243810 = r4243808 * r4243809;
        double r4243811 = b;
        double r4243812 = r4243811 * r4243811;
        double r4243813 = fma(r4243807, r4243810, r4243812);
        double r4243814 = sqrt(r4243813);
        double r4243815 = sqrt(r4243814);
        double r4243816 = r4243810 * r4243807;
        double r4243817 = fma(r4243811, r4243811, r4243816);
        double r4243818 = sqrt(r4243817);
        double r4243819 = sqrt(r4243818);
        double r4243820 = -r4243811;
        double r4243821 = fma(r4243815, r4243819, r4243820);
        double r4243822 = 0.3333333333333333;
        double r4243823 = cbrt(r4243822);
        double r4243824 = r4243823 * r4243823;
        double r4243825 = r4243823 / r4243808;
        double r4243826 = r4243824 * r4243825;
        double r4243827 = r4243821 * r4243826;
        return r4243827;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 44.0

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
  2. Simplified44.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 add-sqr-sqrt44.0

    \[\leadsto \frac{\sqrt{\color{blue}{\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)}}} - b}{3 \cdot a}\]
  5. Applied sqrt-prod44.0

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

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}, -b\right)}}{3 \cdot a}\]
  7. Taylor expanded around 0 43.4

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

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

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

    \[\leadsto \mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(b, b, -3 \cdot \left(a \cdot c\right)\right)}}, -b\right) \cdot \color{blue}{\frac{\frac{1}{3}}{a}}\]
  12. Using strategy rm
  13. Applied *-un-lft-identity43.3

    \[\leadsto \mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(b, b, -3 \cdot \left(a \cdot c\right)\right)}}, -b\right) \cdot \frac{\frac{1}{3}}{\color{blue}{1 \cdot a}}\]
  14. Applied add-cube-cbrt43.3

    \[\leadsto \mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(b, b, -3 \cdot \left(a \cdot c\right)\right)}}, -b\right) \cdot \frac{\color{blue}{\left(\sqrt[3]{\frac{1}{3}} \cdot \sqrt[3]{\frac{1}{3}}\right) \cdot \sqrt[3]{\frac{1}{3}}}}{1 \cdot a}\]
  15. Applied times-frac43.3

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

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

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

Reproduce

herbie shell --seed 2019142 +o rules:numerics
(FPCore (a b c)
  :name "Cubic critical, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))