Average Error: 3.3 → 1.3
Time: 8.0s
Precision: 64
\[\frac{3 \cdot ac - {b}^{2}}{3 \cdot {a}^{2}}\]
\[\begin{array}{l} \mathbf{if}\;ac \le 0.0:\\ \;\;\;\;{\left(\frac{1}{{a}^{2}}\right)}^{1} \cdot ac\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{ac} + \frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}}}{{a}^{\left(\frac{2}{2}\right)}} \cdot \frac{\sqrt{ac} - \frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}}}{{a}^{\left(\frac{2}{2}\right)}}\\ \end{array}\]
\frac{3 \cdot ac - {b}^{2}}{3 \cdot {a}^{2}}
\begin{array}{l}
\mathbf{if}\;ac \le 0.0:\\
\;\;\;\;{\left(\frac{1}{{a}^{2}}\right)}^{1} \cdot ac\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{ac} + \frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}}}{{a}^{\left(\frac{2}{2}\right)}} \cdot \frac{\sqrt{ac} - \frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}}}{{a}^{\left(\frac{2}{2}\right)}}\\

\end{array}
double f(double ac, double b, double a) {
        double r3039511 = 3.0;
        double r3039512 = ac;
        double r3039513 = r3039511 * r3039512;
        double r3039514 = b;
        double r3039515 = 2.0;
        double r3039516 = pow(r3039514, r3039515);
        double r3039517 = r3039513 - r3039516;
        double r3039518 = a;
        double r3039519 = pow(r3039518, r3039515);
        double r3039520 = r3039511 * r3039519;
        double r3039521 = r3039517 / r3039520;
        return r3039521;
}

double f(double ac, double b, double a) {
        double r3039522 = ac;
        double r3039523 = 0.0;
        bool r3039524 = r3039522 <= r3039523;
        double r3039525 = 1.0;
        double r3039526 = a;
        double r3039527 = 2.0;
        double r3039528 = pow(r3039526, r3039527);
        double r3039529 = r3039525 / r3039528;
        double r3039530 = 1.0;
        double r3039531 = pow(r3039529, r3039530);
        double r3039532 = r3039531 * r3039522;
        double r3039533 = sqrt(r3039522);
        double r3039534 = b;
        double r3039535 = 2.0;
        double r3039536 = r3039527 / r3039535;
        double r3039537 = pow(r3039534, r3039536);
        double r3039538 = 3.0;
        double r3039539 = sqrt(r3039538);
        double r3039540 = r3039537 / r3039539;
        double r3039541 = r3039533 + r3039540;
        double r3039542 = pow(r3039526, r3039536);
        double r3039543 = r3039541 / r3039542;
        double r3039544 = r3039533 - r3039540;
        double r3039545 = r3039544 / r3039542;
        double r3039546 = r3039543 * r3039545;
        double r3039547 = r3039524 ? r3039532 : r3039546;
        return r3039547;
}

Error

Bits error versus ac

Bits error versus b

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if ac < 0.0

    1. Initial program 3.3

      \[\frac{3 \cdot ac - {b}^{2}}{3 \cdot {a}^{2}}\]
    2. Simplified3.3

      \[\leadsto \color{blue}{\frac{ac - \frac{{b}^{2}}{3}}{{a}^{2}}}\]
    3. Taylor expanded around inf 2.5

      \[\leadsto \color{blue}{{\left(\frac{1}{{a}^{2}}\right)}^{1} \cdot ac}\]

    if 0.0 < ac

    1. Initial program 3.2

      \[\frac{3 \cdot ac - {b}^{2}}{3 \cdot {a}^{2}}\]
    2. Simplified3.2

      \[\leadsto \color{blue}{\frac{ac - \frac{{b}^{2}}{3}}{{a}^{2}}}\]
    3. Using strategy rm
    4. Applied sqr-pow3.2

      \[\leadsto \frac{ac - \frac{{b}^{2}}{3}}{\color{blue}{{a}^{\left(\frac{2}{2}\right)} \cdot {a}^{\left(\frac{2}{2}\right)}}}\]
    5. Applied add-sqr-sqrt3.2

      \[\leadsto \frac{ac - \frac{{b}^{2}}{\color{blue}{\sqrt{3} \cdot \sqrt{3}}}}{{a}^{\left(\frac{2}{2}\right)} \cdot {a}^{\left(\frac{2}{2}\right)}}\]
    6. Applied sqr-pow3.2

      \[\leadsto \frac{ac - \frac{\color{blue}{{b}^{\left(\frac{2}{2}\right)} \cdot {b}^{\left(\frac{2}{2}\right)}}}{\sqrt{3} \cdot \sqrt{3}}}{{a}^{\left(\frac{2}{2}\right)} \cdot {a}^{\left(\frac{2}{2}\right)}}\]
    7. Applied times-frac3.2

      \[\leadsto \frac{ac - \color{blue}{\frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}} \cdot \frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}}}}{{a}^{\left(\frac{2}{2}\right)} \cdot {a}^{\left(\frac{2}{2}\right)}}\]
    8. Applied add-sqr-sqrt3.2

      \[\leadsto \frac{\color{blue}{\sqrt{ac} \cdot \sqrt{ac}} - \frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}} \cdot \frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}}}{{a}^{\left(\frac{2}{2}\right)} \cdot {a}^{\left(\frac{2}{2}\right)}}\]
    9. Applied difference-of-squares3.2

      \[\leadsto \frac{\color{blue}{\left(\sqrt{ac} + \frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}}\right) \cdot \left(\sqrt{ac} - \frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}}\right)}}{{a}^{\left(\frac{2}{2}\right)} \cdot {a}^{\left(\frac{2}{2}\right)}}\]
    10. Applied times-frac0

      \[\leadsto \color{blue}{\frac{\sqrt{ac} + \frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}}}{{a}^{\left(\frac{2}{2}\right)}} \cdot \frac{\sqrt{ac} - \frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}}}{{a}^{\left(\frac{2}{2}\right)}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;ac \le 0.0:\\ \;\;\;\;{\left(\frac{1}{{a}^{2}}\right)}^{1} \cdot ac\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{ac} + \frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}}}{{a}^{\left(\frac{2}{2}\right)}} \cdot \frac{\sqrt{ac} - \frac{{b}^{\left(\frac{2}{2}\right)}}{\sqrt{3}}}{{a}^{\left(\frac{2}{2}\right)}}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (ac b a)
  :name "(3ac-b^2)/(3a^2)"
  :precision binary32
  (/ (- (* 3 ac) (pow b 2)) (* 3 (pow a 2))))