Average Error: 28.7 → 25.2
Time: 38.1s
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{\frac{\left(b \cdot b\right) \cdot \frac{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)} - b \cdot \left(b \cdot b\right)}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)} + b, \mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)\right)} + \sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right)}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, b \cdot b + \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)\right)}}{a \cdot 3}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{\frac{\left(b \cdot b\right) \cdot \frac{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right) \cdot \sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)} - b \cdot \left(b \cdot b\right)}{\mathsf{fma}\left(b, \sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)} + b, \mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)\right)} + \sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right)}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, b \cdot b + \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)\right)}}{a \cdot 3}
double f(double a, double b, double c) {
        double r4763464 = b;
        double r4763465 = -r4763464;
        double r4763466 = r4763464 * r4763464;
        double r4763467 = 3.0;
        double r4763468 = a;
        double r4763469 = r4763467 * r4763468;
        double r4763470 = c;
        double r4763471 = r4763469 * r4763470;
        double r4763472 = r4763466 - r4763471;
        double r4763473 = sqrt(r4763472);
        double r4763474 = r4763465 + r4763473;
        double r4763475 = r4763474 / r4763469;
        return r4763475;
}

double f(double a, double b, double c) {
        double r4763476 = b;
        double r4763477 = r4763476 * r4763476;
        double r4763478 = -3.0;
        double r4763479 = c;
        double r4763480 = r4763478 * r4763479;
        double r4763481 = a;
        double r4763482 = fma(r4763480, r4763481, r4763477);
        double r4763483 = sqrt(r4763482);
        double r4763484 = r4763482 * r4763483;
        double r4763485 = r4763476 * r4763477;
        double r4763486 = r4763484 - r4763485;
        double r4763487 = r4763483 + r4763476;
        double r4763488 = fma(r4763476, r4763487, r4763482);
        double r4763489 = r4763486 / r4763488;
        double r4763490 = r4763477 * r4763489;
        double r4763491 = r4763481 * r4763479;
        double r4763492 = fma(r4763491, r4763478, r4763477);
        double r4763493 = sqrt(r4763492);
        double r4763494 = r4763491 * r4763478;
        double r4763495 = r4763493 * r4763494;
        double r4763496 = r4763490 + r4763495;
        double r4763497 = r4763477 + r4763492;
        double r4763498 = fma(r4763493, r4763476, r4763497);
        double r4763499 = r4763496 / r4763498;
        double r4763500 = 3.0;
        double r4763501 = r4763481 * r4763500;
        double r4763502 = r4763499 / r4763501;
        return r4763502;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 28.7

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
  2. Simplified28.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--28.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. Simplified28.1

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

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

    \[\leadsto \frac{\frac{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \color{blue}{\left(\left(a \cdot c\right) \cdot -3 + b \cdot b\right)} - b \cdot \left(b \cdot b\right)}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) + b \cdot b\right)}}{3 \cdot a}\]
  9. Applied distribute-lft-in27.9

    \[\leadsto \frac{\frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right) + \sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(b \cdot b\right)\right)} - b \cdot \left(b \cdot b\right)}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) + b \cdot b\right)}}{3 \cdot a}\]
  10. Applied associate--l+26.2

    \[\leadsto \frac{\frac{\color{blue}{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right) + \left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(b \cdot b\right) - b \cdot \left(b \cdot b\right)\right)}}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) + b \cdot b\right)}}{3 \cdot a}\]
  11. Using strategy rm
  12. Applied distribute-rgt-out--25.7

    \[\leadsto \frac{\frac{\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} \cdot \left(\left(a \cdot c\right) \cdot -3\right) + \color{blue}{\left(b \cdot b\right) \cdot \left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)} - b\right)}}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(a \cdot c, -3, b \cdot b\right)}, b, \mathsf{fma}\left(a \cdot c, -3, b \cdot b\right) + b \cdot b\right)}}{3 \cdot a}\]
  13. Using strategy rm
  14. Applied flip3--25.8

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

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

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

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

Reproduce

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