?

Average Error: 60.1 → 0.4
Time: 18.2s
Precision: binary64
Cost: 40704

?

\[\left(\left(-30.0833339823863 \leq b \land b \leq -30.0833339823863\right) \land \left(-1 \leq a \land a \leq 1\right)\right) \land \left(1038.5017412320815 \leq c \land c \leq 1038.5017412320815\right)\]
\[\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
\[\mathsf{fma}\left(-0.25, {\left(c \cdot a\right)}^{4} \cdot \frac{20}{a \cdot {b}^{7}}, \frac{{c}^{3} \cdot -2}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - a \cdot \frac{c \cdot c}{{b}^{3}} \]
(FPCore (b a c)
 :precision binary64
 (/ (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (b a c)
 :precision binary64
 (-
  (fma
   -0.25
   (* (pow (* c a) 4.0) (/ 20.0 (* a (pow b 7.0))))
   (- (/ (* (pow c 3.0) -2.0) (/ (pow b 5.0) (* a a))) (/ c b)))
  (* a (/ (* c c) (pow b 3.0)))))
double code(double b, double a, double c) {
	return (-b - sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
double code(double b, double a, double c) {
	return fma(-0.25, (pow((c * a), 4.0) * (20.0 / (a * pow(b, 7.0)))), (((pow(c, 3.0) * -2.0) / (pow(b, 5.0) / (a * a))) - (c / b))) - (a * ((c * c) / pow(b, 3.0)));
}
function code(b, a, c)
	return Float64(Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
end
function code(b, a, c)
	return Float64(fma(-0.25, Float64((Float64(c * a) ^ 4.0) * Float64(20.0 / Float64(a * (b ^ 7.0)))), Float64(Float64(Float64((c ^ 3.0) * -2.0) / Float64((b ^ 5.0) / Float64(a * a))) - Float64(c / b))) - Float64(a * Float64(Float64(c * c) / (b ^ 3.0))))
end
code[b_, a_, c_] := N[(N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
code[b_, a_, c_] := N[(N[(-0.25 * N[(N[Power[N[(c * a), $MachinePrecision], 4.0], $MachinePrecision] * N[(20.0 / N[(a * N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[Power[c, 3.0], $MachinePrecision] * -2.0), $MachinePrecision] / N[(N[Power[b, 5.0], $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(N[(c * c), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\mathsf{fma}\left(-0.25, {\left(c \cdot a\right)}^{4} \cdot \frac{20}{a \cdot {b}^{7}}, \frac{{c}^{3} \cdot -2}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - a \cdot \frac{c \cdot c}{{b}^{3}}

Error?

Derivation?

  1. Initial program 60.1

    \[\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Simplified60.1

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

    [Start]60.1

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

    *-lft-identity [<=]60.1

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

    metadata-eval [<=]60.1

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

    associate-*r/ [=>]60.1

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

    associate-*l/ [<=]60.1

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

    distribute-neg-frac [<=]60.1

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

    distribute-lft-neg-in [<=]60.1

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

    distribute-rgt-neg-out [<=]60.1

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

    associate-/r* [=>]60.1

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

    metadata-eval [=>]60.1

    \[ \frac{\color{blue}{-0.5}}{a} \cdot \left(-\left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \]

    sub-neg [=>]60.1

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

    distribute-neg-out [=>]60.1

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

    remove-double-neg [=>]60.1

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

    fma-neg [=>]60.1

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

    associate-*l* [=>]60.1

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

    *-commutative [=>]60.1

    \[ \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(a \cdot c\right) \cdot 4}\right)}\right) \]
  3. Taylor expanded in b around -inf 0.4

    \[\leadsto \color{blue}{-1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + \left(-0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right)} \]
  4. Simplified0.4

    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25, \frac{4 \cdot \left({c}^{4} \cdot {a}^{4}\right) + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}}, \frac{{c}^{3} \cdot -2}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - \frac{c \cdot c}{{b}^{3}} \cdot a} \]
    Proof

    [Start]0.4

    \[ -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + \left(-0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) \]

    +-commutative [=>]0.4

    \[ \color{blue}{\left(-0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]

    mul-1-neg [=>]0.4

    \[ \left(-0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) + \color{blue}{\left(-\frac{{c}^{2} \cdot a}{{b}^{3}}\right)} \]

    unsub-neg [=>]0.4

    \[ \color{blue}{\left(-0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
  5. Taylor expanded in c around 0 0.4

    \[\leadsto \mathsf{fma}\left(-0.25, \color{blue}{\frac{{c}^{4} \cdot \left(16 \cdot {a}^{4} + 4 \cdot {a}^{4}\right)}{a \cdot {b}^{7}}}, \frac{{c}^{3} \cdot -2}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - \frac{c \cdot c}{{b}^{3}} \cdot a \]
  6. Simplified0.4

    \[\leadsto \mathsf{fma}\left(-0.25, \color{blue}{{\left(c \cdot a\right)}^{4} \cdot \frac{20}{a \cdot {b}^{7}}}, \frac{{c}^{3} \cdot -2}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - \frac{c \cdot c}{{b}^{3}} \cdot a \]
    Proof

    [Start]0.4

    \[ \mathsf{fma}\left(-0.25, \frac{{c}^{4} \cdot \left(16 \cdot {a}^{4} + 4 \cdot {a}^{4}\right)}{a \cdot {b}^{7}}, \frac{{c}^{3} \cdot -2}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - \frac{c \cdot c}{{b}^{3}} \cdot a \]
  7. Final simplification0.4

    \[\leadsto \mathsf{fma}\left(-0.25, {\left(c \cdot a\right)}^{4} \cdot \frac{20}{a \cdot {b}^{7}}, \frac{{c}^{3} \cdot -2}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - a \cdot \frac{c \cdot c}{{b}^{3}} \]

Alternatives

Alternative 1
Error0.5
Cost20736
\[\left(\frac{{c}^{3} \cdot -2}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - a \cdot \frac{c \cdot c}{{b}^{3}} \]
Alternative 2
Error0.7
Cost1024
\[\frac{-c}{b} - \frac{\frac{a \cdot \left(c \cdot c\right)}{b \cdot b}}{b} \]
Alternative 3
Error1.2
Cost256
\[\frac{-c}{b} \]

Error

Reproduce?

herbie shell --seed 1 
(FPCore (b a c)
  :name "(-b - sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)"
  :precision binary64
  :pre (and (and (and (<= -30.0833339823863 b) (<= b -30.0833339823863)) (and (<= -1.0 a) (<= a 1.0))) (and (<= 1038.5017412320815 c) (<= c 1038.5017412320815)))
  (/ (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))