?

Average Error: 68.6% → 4.6%
Time: 31.6s
Precision: binary64

?

\[\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(-2 \cdot \left(c \cdot a\right)\right)}^{2}\\ -1 \cdot \frac{c}{b} + \left(-0.25 \cdot \frac{{\left(\frac{1}{b}\right)}^{7} \cdot \left(4 \cdot \left(t_0 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right) + {\left(-0.5 \cdot t_0\right)}^{2}\right)}{a} + \left(-0.5 \cdot \left(c \cdot \left({\left(\frac{1}{b}\right)}^{5} \cdot t_0\right)\right) + -0.25 \cdot \frac{{\left(\frac{1}{b}\right)}^{3} \cdot t_0}{a}\right)\right) \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 (* -2.0 (* c a)) 2.0)))
   (+
    (* -1.0 (/ c b))
    (+
     (*
      -0.25
      (/
       (*
        (pow (/ 1.0 b) 7.0)
        (+ (* 4.0 (* t_0 (* (pow a 2.0) (pow c 2.0)))) (pow (* -0.5 t_0) 2.0)))
       a))
     (+
      (* -0.5 (* c (* (pow (/ 1.0 b) 5.0) t_0)))
      (* -0.25 (/ (* (pow (/ 1.0 b) 3.0) t_0) a)))))))
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((-2.0 * (c * a)), 2.0);
	return (-1.0 * (c / b)) + ((-0.25 * ((pow((1.0 / b), 7.0) * ((4.0 * (t_0 * (pow(a, 2.0) * pow(c, 2.0)))) + pow((-0.5 * t_0), 2.0))) / a)) + ((-0.5 * (c * (pow((1.0 / b), 5.0) * t_0))) + (-0.25 * ((pow((1.0 / b), 3.0) * t_0) / a))));
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-b + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    t_0 = ((-2.0d0) * (c * a)) ** 2.0d0
    code = ((-1.0d0) * (c / b)) + (((-0.25d0) * ((((1.0d0 / b) ** 7.0d0) * ((4.0d0 * (t_0 * ((a ** 2.0d0) * (c ** 2.0d0)))) + (((-0.5d0) * t_0) ** 2.0d0))) / a)) + (((-0.5d0) * (c * (((1.0d0 / b) ** 5.0d0) * t_0))) + ((-0.25d0) * ((((1.0d0 / b) ** 3.0d0) * t_0) / a))))
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
public static double code(double a, double b, double c) {
	double t_0 = Math.pow((-2.0 * (c * a)), 2.0);
	return (-1.0 * (c / b)) + ((-0.25 * ((Math.pow((1.0 / b), 7.0) * ((4.0 * (t_0 * (Math.pow(a, 2.0) * Math.pow(c, 2.0)))) + Math.pow((-0.5 * t_0), 2.0))) / a)) + ((-0.5 * (c * (Math.pow((1.0 / b), 5.0) * t_0))) + (-0.25 * ((Math.pow((1.0 / b), 3.0) * t_0) / a))));
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
def code(a, b, c):
	t_0 = math.pow((-2.0 * (c * a)), 2.0)
	return (-1.0 * (c / b)) + ((-0.25 * ((math.pow((1.0 / b), 7.0) * ((4.0 * (t_0 * (math.pow(a, 2.0) * math.pow(c, 2.0)))) + math.pow((-0.5 * t_0), 2.0))) / a)) + ((-0.5 * (c * (math.pow((1.0 / b), 5.0) * t_0))) + (-0.25 * ((math.pow((1.0 / b), 3.0) * t_0) / a))))
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(-2.0 * Float64(c * a)) ^ 2.0
	return Float64(Float64(-1.0 * Float64(c / b)) + Float64(Float64(-0.25 * Float64(Float64((Float64(1.0 / b) ^ 7.0) * Float64(Float64(4.0 * Float64(t_0 * Float64((a ^ 2.0) * (c ^ 2.0)))) + (Float64(-0.5 * t_0) ^ 2.0))) / a)) + Float64(Float64(-0.5 * Float64(c * Float64((Float64(1.0 / b) ^ 5.0) * t_0))) + Float64(-0.25 * Float64(Float64((Float64(1.0 / b) ^ 3.0) * t_0) / a)))))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
end
function tmp = code(a, b, c)
	t_0 = (-2.0 * (c * a)) ^ 2.0;
	tmp = (-1.0 * (c / b)) + ((-0.25 * ((((1.0 / b) ^ 7.0) * ((4.0 * (t_0 * ((a ^ 2.0) * (c ^ 2.0)))) + ((-0.5 * t_0) ^ 2.0))) / a)) + ((-0.5 * (c * (((1.0 / b) ^ 5.0) * t_0))) + (-0.25 * ((((1.0 / b) ^ 3.0) * t_0) / a))));
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[(-2.0 * N[(c * a), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, N[(N[(-1.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.25 * N[(N[(N[Power[N[(1.0 / b), $MachinePrecision], 7.0], $MachinePrecision] * N[(N[(4.0 * N[(t$95$0 * N[(N[Power[a, 2.0], $MachinePrecision] * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(-0.5 * t$95$0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * N[(c * N[(N[Power[N[(1.0 / b), $MachinePrecision], 5.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.25 * N[(N[(N[Power[N[(1.0 / b), $MachinePrecision], 3.0], $MachinePrecision] * t$95$0), $MachinePrecision] / a), $MachinePrecision]), $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(-2 \cdot \left(c \cdot a\right)\right)}^{2}\\
-1 \cdot \frac{c}{b} + \left(-0.25 \cdot \frac{{\left(\frac{1}{b}\right)}^{7} \cdot \left(4 \cdot \left(t_0 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right) + {\left(-0.5 \cdot t_0\right)}^{2}\right)}{a} + \left(-0.5 \cdot \left(c \cdot \left({\left(\frac{1}{b}\right)}^{5} \cdot t_0\right)\right) + -0.25 \cdot \frac{{\left(\frac{1}{b}\right)}^{3} \cdot t_0}{a}\right)\right)
\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 68.6

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

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

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

Reproduce?

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