?

Average Error: 17.9% → 99.0%
Time: 29.6s
Precision: binary64
Cost: 20736.00

?

\[\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{\frac{{a}^{3} \cdot \left(3 \cdot c\right)}{a \cdot \left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)} \cdot -0.3333333333333333}{a \cdot a} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
(FPCore (a b c)
 :precision binary64
 (/
  (*
   (/ (* (pow a 3.0) (* 3.0 c)) (* a (+ b (sqrt (fma a (* c -3.0) (* b b))))))
   -0.3333333333333333)
  (* a a)))
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 (((pow(a, 3.0) * (3.0 * c)) / (a * (b + sqrt(fma(a, (c * -3.0), (b * b)))))) * -0.3333333333333333) / (a * a);
}
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(Float64(Float64(Float64((a ^ 3.0) * Float64(3.0 * c)) / Float64(a * Float64(b + sqrt(fma(a, Float64(c * -3.0), Float64(b * b)))))) * -0.3333333333333333) / Float64(a * a))
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[(N[(N[(N[(N[Power[a, 3.0], $MachinePrecision] * N[(3.0 * c), $MachinePrecision]), $MachinePrecision] / N[(a * N[(b + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{\frac{{a}^{3} \cdot \left(3 \cdot c\right)}{a \cdot \left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)} \cdot -0.3333333333333333}{a \cdot a}

Error?

Derivation?

  1. Initial program 17.9

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

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

    [Start]17.9

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

    *-lft-identity [<=]17.9

    \[ \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.9

    \[ \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.9

    \[ \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.9

    \[ \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.9

    \[ \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.9

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

    *-commutative [=>]17.9

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

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

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

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

    [Start]18.7

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

    *-commutative [<=]18.7

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

    *-commutative [=>]18.7

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

    associate-*l* [=>]18.7

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

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

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

    [Start]99.0

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

    associate-*r* [=>]99.0

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

    *-commutative [=>]99.0

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

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

Alternatives

Alternative 1
Error99.0%
Cost20736.00
\[\frac{-0.3333333333333333 \cdot \frac{3 \cdot \left({a}^{3} \cdot c\right)}{a \cdot \left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)}}{a \cdot a} \]
Alternative 2
Error95.5%
Cost13696.00
\[\mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, -0.5 \cdot \frac{c}{b}\right) \]
Alternative 3
Error90.1%
Cost320.00
\[c \cdot \frac{-0.5}{b} \]
Alternative 4
Error90.4%
Cost320.00
\[\frac{c \cdot -0.5}{b} \]
Alternative 5
Error3.3%
Cost192.00
\[\frac{0}{a} \]

Error

Reproduce?

herbie shell --seed 2023093 
(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)))