?

Average Accuracy: 18.0% → 99.1%
Time: 17.4s
Precision: binary64
Cost: 14144

?

\[\left(\left(4.930380657631324 \cdot 10^{-32} < a \land a < 2.028240960365167 \cdot 10^{+31}\right) \land \left(4.930380657631324 \cdot 10^{-32} < b \land b < 2.028240960365167 \cdot 10^{+31}\right)\right) \land \left(4.930380657631324 \cdot 10^{-32} < c \land c < 2.028240960365167 \cdot 10^{+31}\right)\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
\[\frac{-0.3333333333333333}{\frac{\frac{b}{a} + \frac{\sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}}{a}}{\frac{3}{\frac{a}{c}}}} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
(FPCore (a b c)
 :precision binary64
 (/
  -0.3333333333333333
  (/ (+ (/ b a) (/ (sqrt (fma c (* a -3.0) (* b b))) a)) (/ 3.0 (/ a c)))))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
double code(double a, double b, double c) {
	return -0.3333333333333333 / (((b / a) + (sqrt(fma(c, (a * -3.0), (b * b))) / a)) / (3.0 / (a / c)));
}
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a))
end
function code(a, b, c)
	return Float64(-0.3333333333333333 / Float64(Float64(Float64(b / a) + Float64(sqrt(fma(c, Float64(a * -3.0), Float64(b * b))) / a)) / Float64(3.0 / Float64(a / c))))
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
code[a_, b_, c_] := N[(-0.3333333333333333 / N[(N[(N[(b / a), $MachinePrecision] + N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] / N[(3.0 / N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{-0.3333333333333333}{\frac{\frac{b}{a} + \frac{\sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}}{a}}{\frac{3}{\frac{a}{c}}}}

Error?

Derivation?

  1. Initial program 17.2%

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

    \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{b - \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}{a}} \]
    Step-by-step derivation

    [Start]17.2

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

    /-rgt-identity [<=]17.2

    \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\color{blue}{\frac{3 \cdot a}{1}}} \]

    metadata-eval [<=]17.2

    \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\frac{3 \cdot a}{\color{blue}{--1}}} \]

    associate-/l* [<=]17.2

    \[ \color{blue}{\frac{\left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right) \cdot \left(--1\right)}{3 \cdot a}} \]

    associate-*r/ [<=]17.2

    \[ \color{blue}{\left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right) \cdot \frac{--1}{3 \cdot a}} \]

    *-commutative [=>]17.2

    \[ \color{blue}{\frac{--1}{3 \cdot a} \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)} \]

    associate-*l/ [=>]17.2

    \[ \color{blue}{\frac{\left(--1\right) \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{3 \cdot a}} \]

    associate-*r/ [<=]17.2

    \[ \color{blue}{\left(--1\right) \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}} \]

    metadata-eval [=>]17.2

    \[ \color{blue}{1} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]

    metadata-eval [<=]17.2

    \[ \color{blue}{\frac{-1}{-1}} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]

    times-frac [<=]17.2

    \[ \color{blue}{\frac{-1 \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{-1 \cdot \left(3 \cdot a\right)}} \]

    neg-mul-1 [<=]17.2

    \[ \frac{-1 \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{\color{blue}{-3 \cdot a}} \]

    distribute-rgt-neg-in [=>]17.2

    \[ \frac{-1 \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{\color{blue}{3 \cdot \left(-a\right)}} \]

    times-frac [=>]17.2

    \[ \color{blue}{\frac{-1}{3} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{-a}} \]

    metadata-eval [=>]17.2

    \[ \color{blue}{-0.3333333333333333} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{-a} \]

    neg-mul-1 [=>]17.2

    \[ -0.3333333333333333 \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\color{blue}{-1 \cdot a}} \]
  3. Applied egg-rr18.6%

    \[\leadsto -0.3333333333333333 \cdot \color{blue}{\left(\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{b}{\sqrt{a}}, -\frac{{\left(\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)\right)}^{0.25}}{a} \cdot \frac{{\left(\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)\right)}^{0.25}}{1}\right) + \mathsf{fma}\left(-\frac{{\left(\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)\right)}^{0.25}}{a}, \frac{{\left(\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)\right)}^{0.25}}{1}, \frac{{\left(\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)\right)}^{0.25}}{a} \cdot \frac{{\left(\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)\right)}^{0.25}}{1}\right)\right)} \]
    Step-by-step derivation

    [Start]17.3

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

    div-sub [=>]17.0

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

    *-un-lft-identity [=>]17.0

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

    add-sqr-sqrt [=>]17.4

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

    times-frac [=>]17.7

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

    add-sqr-sqrt [=>]17.7

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

    *-un-lft-identity [=>]17.7

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

    times-frac [=>]17.7

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

    prod-diff [=>]18.6

    \[ -0.3333333333333333 \cdot \color{blue}{\left(\mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{b}{\sqrt{a}}, -\frac{\sqrt{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}}{a} \cdot \frac{\sqrt{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}}{1}\right) + \mathsf{fma}\left(-\frac{\sqrt{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}}{a}, \frac{\sqrt{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}}{1}, \frac{\sqrt{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}}{a} \cdot \frac{\sqrt{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}}{1}\right)\right)} \]
  4. Simplified17.8%

    \[\leadsto -0.3333333333333333 \cdot \color{blue}{\left(0 \cdot \frac{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{0.5}}{a} + \left(\frac{1}{\sqrt{a}} \cdot \frac{b}{\sqrt{a}} - \frac{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{0.5}}{a}\right)\right)} \]
    Step-by-step derivation

    [Start]18.6

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

    +-commutative [=>]18.6

    \[ -0.3333333333333333 \cdot \color{blue}{\left(\mathsf{fma}\left(-\frac{{\left(\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)\right)}^{0.25}}{a}, \frac{{\left(\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)\right)}^{0.25}}{1}, \frac{{\left(\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)\right)}^{0.25}}{a} \cdot \frac{{\left(\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)\right)}^{0.25}}{1}\right) + \mathsf{fma}\left(\frac{1}{\sqrt{a}}, \frac{b}{\sqrt{a}}, -\frac{{\left(\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)\right)}^{0.25}}{a} \cdot \frac{{\left(\mathsf{fma}\left(c, -3 \cdot a, b \cdot b\right)\right)}^{0.25}}{1}\right)\right)} \]
  5. Applied egg-rr18.2%

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

    [Start]17.8

    \[ -0.3333333333333333 \cdot \left(0 \cdot \frac{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{0.5}}{a} + \left(\frac{1}{\sqrt{a}} \cdot \frac{b}{\sqrt{a}} - \frac{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{0.5}}{a}\right)\right) \]

    mul0-lft [=>]17.8

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

    +-lft-identity [=>]17.8

    \[ -0.3333333333333333 \cdot \color{blue}{\left(\frac{1}{\sqrt{a}} \cdot \frac{b}{\sqrt{a}} - \frac{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{0.5}}{a}\right)} \]

    flip-- [=>]17.8

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

    associate-*r/ [=>]17.8

    \[ \color{blue}{\frac{-0.3333333333333333 \cdot \left(\left(\frac{1}{\sqrt{a}} \cdot \frac{b}{\sqrt{a}}\right) \cdot \left(\frac{1}{\sqrt{a}} \cdot \frac{b}{\sqrt{a}}\right) - \frac{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{0.5}}{a} \cdot \frac{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{0.5}}{a}\right)}{\frac{1}{\sqrt{a}} \cdot \frac{b}{\sqrt{a}} + \frac{{\left(\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)\right)}^{0.5}}{a}}} \]
  6. Simplified18.2%

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

    [Start]18.2

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

    associate-/l* [=>]18.2

    \[ \color{blue}{\frac{-0.3333333333333333}{\frac{\frac{b}{a} + \frac{\sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}}{a}}{{\left(\frac{b}{a}\right)}^{2} - \frac{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}{a \cdot a}}}} \]
  7. Taylor expanded in b around 0 99.1%

    \[\leadsto \frac{-0.3333333333333333}{\frac{\frac{b}{a} + \frac{\sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}}{a}}{\color{blue}{3 \cdot \frac{c}{a}}}} \]
  8. Applied egg-rr99.1%

    \[\leadsto \frac{-0.3333333333333333}{\frac{\frac{b}{a} + \frac{\sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}}{a}}{\color{blue}{\frac{3}{\frac{a}{c}}}}} \]
    Step-by-step derivation

    [Start]99.1

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

    clear-num [=>]99.1

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

    un-div-inv [=>]99.1

    \[ \frac{-0.3333333333333333}{\frac{\frac{b}{a} + \frac{\sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}}{a}}{\color{blue}{\frac{3}{\frac{a}{c}}}}} \]
  9. Final simplification99.1%

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

Alternatives

Alternative 1
Accuracy99.1%
Cost7872
\[\frac{-0.3333333333333333}{\frac{\frac{b}{a} + \frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)}}{a}}{3 \cdot \frac{c}{a}}} \]
Alternative 2
Accuracy95.0%
Cost7104
\[\frac{-0.3333333333333333}{\mathsf{fma}\left(0.6666666666666666, \frac{b}{c}, -0.5 \cdot \frac{a}{b}\right)} \]
Alternative 3
Accuracy95.0%
Cost832
\[\frac{-0.3333333333333333}{-0.5 \cdot \frac{a}{b} + 0.6666666666666666 \cdot \frac{b}{c}} \]
Alternative 4
Accuracy90.0%
Cost320
\[c \cdot \frac{-0.5}{b} \]
Alternative 5
Accuracy90.0%
Cost320
\[\frac{-0.5}{\frac{b}{c}} \]
Alternative 6
Accuracy90.3%
Cost320
\[\frac{c \cdot -0.5}{b} \]
Alternative 7
Accuracy3.3%
Cost64
\[0 \]

Error

Reproduce?

herbie shell --seed 2023159 
(FPCore (a b c)
  :name "Cubic critical, wide range"
  :precision binary64
  :pre (and (and (and (< 4.930380657631324e-32 a) (< a 2.028240960365167e+31)) (and (< 4.930380657631324e-32 b) (< b 2.028240960365167e+31))) (and (< 4.930380657631324e-32 c) (< c 2.028240960365167e+31)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))