?

Average Accuracy: 31.7% → 95.4%
Time: 18.7s
Precision: binary64
Cost: 34496

?

\[\left(\left(1.1102230246251565 \cdot 10^{-16} < a \land a < 9007199254740992\right) \land \left(1.1102230246251565 \cdot 10^{-16} < b \land b < 9007199254740992\right)\right) \land \left(1.1102230246251565 \cdot 10^{-16} < c \land c < 9007199254740992\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{\frac{20}{a}}{{b}^{7}}, \frac{\left(a \cdot \left(a \cdot -2\right)\right) \cdot {c}^{3}}{{b}^{5}} - \frac{c}{b}\right) - a \cdot \left(\frac{c}{b} \cdot \frac{c}{b \cdot b}\right) \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (a b c)
 :precision binary64
 (-
  (fma
   -0.25
   (* (pow (* c a) 4.0) (/ (/ 20.0 a) (pow b 7.0)))
   (- (/ (* (* a (* a -2.0)) (pow c 3.0)) (pow b 5.0)) (/ c b)))
  (* a (* (/ c b) (/ c (* b b))))))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
double code(double a, double b, double c) {
	return fma(-0.25, (pow((c * a), 4.0) * ((20.0 / a) / pow(b, 7.0))), ((((a * (a * -2.0)) * pow(c, 3.0)) / pow(b, 5.0)) - (c / b))) - (a * ((c / b) * (c / (b * b))));
}
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
end
function code(a, b, c)
	return Float64(fma(-0.25, Float64((Float64(c * a) ^ 4.0) * Float64(Float64(20.0 / a) / (b ^ 7.0))), Float64(Float64(Float64(Float64(a * Float64(a * -2.0)) * (c ^ 3.0)) / (b ^ 5.0)) - Float64(c / b))) - Float64(a * Float64(Float64(c / b) * Float64(c / Float64(b * b)))))
end
code[a_, b_, 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[a_, b_, c_] := N[(N[(-0.25 * N[(N[Power[N[(c * a), $MachinePrecision], 4.0], $MachinePrecision] * N[(N[(20.0 / a), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(a * N[(a * -2.0), $MachinePrecision]), $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(N[(c / b), $MachinePrecision] * N[(c / N[(b * b), $MachinePrecision]), $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{\frac{20}{a}}{{b}^{7}}, \frac{\left(a \cdot \left(a \cdot -2\right)\right) \cdot {c}^{3}}{{b}^{5}} - \frac{c}{b}\right) - a \cdot \left(\frac{c}{b} \cdot \frac{c}{b \cdot b}\right)

Error?

Derivation?

  1. Initial program 31.7%

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

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

    [Start]31.7

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

    *-commutative [=>]31.7

    \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Taylor expanded in b around inf 95.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. Simplified95.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{\left(\left(a \cdot -2\right) \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \frac{c}{b}\right) - \frac{c \cdot c}{{b}^{3}} \cdot a} \]
    Proof

    [Start]95.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 [=>]95.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}}} \]
  5. Taylor expanded in c around 0 95.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{\left(\left(a \cdot -2\right) \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \frac{c}{b}\right) - \frac{c \cdot c}{{b}^{3}} \cdot a \]
  6. Simplified95.4%

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

    [Start]95.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{\left(\left(a \cdot -2\right) \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \frac{c}{b}\right) - \frac{c \cdot c}{{b}^{3}} \cdot a \]
  7. Applied egg-rr95.4%

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

    [Start]95.4

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

    unpow3 [=>]95.4

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

    times-frac [=>]95.4

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

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

Alternatives

Alternative 1
Accuracy93.9%
Cost14528
\[\left(\frac{\left(a \cdot \left(a \cdot -2\right)\right) \cdot {c}^{3}}{{b}^{5}} - \frac{c}{b}\right) - \frac{\frac{a \cdot \left(c \cdot c\right)}{b \cdot b}}{b} \]
Alternative 2
Accuracy90.6%
Cost7232
\[\frac{-c}{b} - a \cdot \frac{c \cdot c}{{b}^{3}} \]
Alternative 3
Accuracy90.3%
Cost1600
\[\left(-2 \cdot \left(a \cdot \frac{c}{b} + \left(\frac{c}{b} \cdot \frac{c}{b \cdot b}\right) \cdot \left(a \cdot a\right)\right)\right) \cdot \frac{0.5}{a} \]
Alternative 4
Accuracy81.0%
Cost256
\[\frac{-c}{b} \]

Error

Reproduce?

herbie shell --seed 2023136 
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :precision binary64
  :pre (and (and (and (< 1.1102230246251565e-16 a) (< a 9007199254740992.0)) (and (< 1.1102230246251565e-16 b) (< b 9007199254740992.0))) (and (< 1.1102230246251565e-16 c) (< c 9007199254740992.0)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))