?

Average Error: 31.6% → 95.4%
Time: 13.1s
Precision: binary64
Cost: 47552.00

?

\[\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} \]
\[\begin{array}{l} t_0 := {\left(c \cdot a\right)}^{4}\\ \mathsf{fma}\left(-0.25, \frac{4 \cdot t_0 + t_0 \cdot 16}{a \cdot {b}^{7}}, \frac{\left(a \cdot \left(a \cdot -2\right)\right) \cdot {c}^{3}}{{b}^{5}} - \frac{c}{b}\right) - a \cdot \frac{c \cdot c}{{b}^{3}} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (pow (* c a) 4.0)))
   (-
    (fma
     -0.25
     (/ (+ (* 4.0 t_0) (* t_0 16.0)) (* a (pow b 7.0)))
     (- (/ (* (* a (* a -2.0)) (pow c 3.0)) (pow b 5.0)) (/ c b)))
    (* a (/ (* c c) (pow b 3.0))))))
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) {
	double t_0 = pow((c * a), 4.0);
	return fma(-0.25, (((4.0 * t_0) + (t_0 * 16.0)) / (a * pow(b, 7.0))), ((((a * (a * -2.0)) * pow(c, 3.0)) / pow(b, 5.0)) - (c / b))) - (a * ((c * c) / pow(b, 3.0)));
}
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)
	t_0 = Float64(c * a) ^ 4.0
	return Float64(fma(-0.25, Float64(Float64(Float64(4.0 * t_0) + Float64(t_0 * 16.0)) / Float64(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 * c) / (b ^ 3.0))))
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_] := Block[{t$95$0 = N[Power[N[(c * a), $MachinePrecision], 4.0], $MachinePrecision]}, N[(N[(-0.25 * N[(N[(N[(4.0 * t$95$0), $MachinePrecision] + N[(t$95$0 * 16.0), $MachinePrecision]), $MachinePrecision] / N[(a * 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 * 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}
\begin{array}{l}
t_0 := {\left(c \cdot a\right)}^{4}\\
\mathsf{fma}\left(-0.25, \frac{4 \cdot t_0 + t_0 \cdot 16}{a \cdot {b}^{7}}, \frac{\left(a \cdot \left(a \cdot -2\right)\right) \cdot {c}^{3}}{{b}^{5}} - \frac{c}{b}\right) - a \cdot \frac{c \cdot c}{{b}^{3}}
\end{array}

Error?

Derivation?

  1. Initial program 31.6

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

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

    [Start]31.6

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

    *-commutative [=>]31.6

    \[ \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. Applied egg-rr95.0

    \[\leadsto \mathsf{fma}\left(-0.25, \frac{4 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({\left(a \cdot c\right)}^{4}\right)} - 1\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 \]
  6. Simplified95.4

    \[\leadsto \mathsf{fma}\left(-0.25, \frac{4 \cdot \color{blue}{{\left(c \cdot a\right)}^{4}} + 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.0

    \[ \mathsf{fma}\left(-0.25, \frac{4 \cdot \left(e^{\mathsf{log1p}\left({\left(a \cdot c\right)}^{4}\right)} - 1\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 \]

    expm1-def [=>]95.4

    \[ \mathsf{fma}\left(-0.25, \frac{4 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(a \cdot c\right)}^{4}\right)\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 \]

    expm1-log1p [=>]95.4

    \[ \mathsf{fma}\left(-0.25, \frac{4 \cdot \color{blue}{{\left(a \cdot c\right)}^{4}} + 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 \]

    *-commutative [=>]95.4

    \[ \mathsf{fma}\left(-0.25, \frac{4 \cdot {\color{blue}{\left(c \cdot a\right)}}^{4} + 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 \]
  7. Applied egg-rr94.8

    \[\leadsto \mathsf{fma}\left(-0.25, \frac{4 \cdot {\left(c \cdot a\right)}^{4} + 16 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({\left(a \cdot c\right)}^{4}\right)} - 1\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 \]
  8. Simplified95.4

    \[\leadsto \mathsf{fma}\left(-0.25, \frac{4 \cdot {\left(c \cdot a\right)}^{4} + 16 \cdot \color{blue}{{\left(c \cdot a\right)}^{4}}}{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]94.8

    \[ \mathsf{fma}\left(-0.25, \frac{4 \cdot {\left(c \cdot a\right)}^{4} + 16 \cdot \left(e^{\mathsf{log1p}\left({\left(a \cdot c\right)}^{4}\right)} - 1\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 \]

    expm1-def [=>]95.4

    \[ \mathsf{fma}\left(-0.25, \frac{4 \cdot {\left(c \cdot a\right)}^{4} + 16 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(a \cdot c\right)}^{4}\right)\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 \]

    expm1-log1p [=>]95.4

    \[ \mathsf{fma}\left(-0.25, \frac{4 \cdot {\left(c \cdot a\right)}^{4} + 16 \cdot \color{blue}{{\left(a \cdot c\right)}^{4}}}{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 \]

    *-commutative [=>]95.4

    \[ \mathsf{fma}\left(-0.25, \frac{4 \cdot {\left(c \cdot a\right)}^{4} + 16 \cdot {\color{blue}{\left(c \cdot a\right)}}^{4}}{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 \]
  9. Final simplification95.4

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

Alternatives

Alternative 1
Error95.4%
Cost41344.00
\[\begin{array}{l} t_0 := {\left(c \cdot a\right)}^{4}\\ \mathsf{fma}\left(-0.25, \frac{4 \cdot t_0 + t_0 \cdot 16}{a \cdot {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) \end{array} \]
Alternative 2
Error93.8%
Cost20736.00
\[\left(\frac{\left(a \cdot \left(a \cdot -2\right)\right) \cdot {c}^{3}}{{b}^{5}} - \frac{c}{b}\right) - a \cdot \frac{c \cdot c}{{b}^{3}} \]
Alternative 3
Error90.6%
Cost1024.00
\[\frac{-c}{b} - \frac{\frac{a \cdot \left(c \cdot c\right)}{b \cdot b}}{b} \]
Alternative 4
Error90.6%
Cost832.00
\[\frac{c}{b} \cdot \left(-1 - \frac{c \cdot a}{b \cdot b}\right) \]
Alternative 5
Error81.2%
Cost256.00
\[\frac{-c}{b} \]
Alternative 6
Error1.6%
Cost192.00
\[\frac{c}{b} \]

Error

Reproduce?

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