Average Error: 52.3 → 1.6
Time: 4.3s
Precision: binary64
\[\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(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
\[-1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + \left(-1 \cdot \frac{c}{b} + \left(-0.25 \cdot \frac{{c}^{4} \cdot \left(16 \cdot {a}^{4} + 4 \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (a b c)
 :precision binary64
 (+
  (* -1.0 (/ (* (pow c 2.0) a) (pow b 3.0)))
  (+
   (* -1.0 (/ c b))
   (+
    (*
     -0.25
     (/
      (* (pow c 4.0) (+ (* 16.0 (pow a 4.0)) (* 4.0 (pow a 4.0))))
      (* a (pow b 7.0))))
    (* -2.0 (/ (* (pow c 3.0) (pow a 2.0)) (pow b 5.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) {
	return (-1.0 * ((pow(c, 2.0) * a) / pow(b, 3.0))) + ((-1.0 * (c / b)) + ((-0.25 * ((pow(c, 4.0) * ((16.0 * pow(a, 4.0)) + (4.0 * pow(a, 4.0)))) / (a * pow(b, 7.0)))) + (-2.0 * ((pow(c, 3.0) * pow(a, 2.0)) / pow(b, 5.0)))));
}
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
    code = ((-1.0d0) * (((c ** 2.0d0) * a) / (b ** 3.0d0))) + (((-1.0d0) * (c / b)) + (((-0.25d0) * (((c ** 4.0d0) * ((16.0d0 * (a ** 4.0d0)) + (4.0d0 * (a ** 4.0d0)))) / (a * (b ** 7.0d0)))) + ((-2.0d0) * (((c ** 3.0d0) * (a ** 2.0d0)) / (b ** 5.0d0)))))
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) {
	return (-1.0 * ((Math.pow(c, 2.0) * a) / Math.pow(b, 3.0))) + ((-1.0 * (c / b)) + ((-0.25 * ((Math.pow(c, 4.0) * ((16.0 * Math.pow(a, 4.0)) + (4.0 * Math.pow(a, 4.0)))) / (a * Math.pow(b, 7.0)))) + (-2.0 * ((Math.pow(c, 3.0) * Math.pow(a, 2.0)) / Math.pow(b, 5.0)))));
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
def code(a, b, c):
	return (-1.0 * ((math.pow(c, 2.0) * a) / math.pow(b, 3.0))) + ((-1.0 * (c / b)) + ((-0.25 * ((math.pow(c, 4.0) * ((16.0 * math.pow(a, 4.0)) + (4.0 * math.pow(a, 4.0)))) / (a * math.pow(b, 7.0)))) + (-2.0 * ((math.pow(c, 3.0) * math.pow(a, 2.0)) / math.pow(b, 5.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)
	return Float64(Float64(-1.0 * Float64(Float64((c ^ 2.0) * a) / (b ^ 3.0))) + Float64(Float64(-1.0 * Float64(c / b)) + Float64(Float64(-0.25 * Float64(Float64((c ^ 4.0) * Float64(Float64(16.0 * (a ^ 4.0)) + Float64(4.0 * (a ^ 4.0)))) / Float64(a * (b ^ 7.0)))) + Float64(-2.0 * Float64(Float64((c ^ 3.0) * (a ^ 2.0)) / (b ^ 5.0))))))
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)
	tmp = (-1.0 * (((c ^ 2.0) * a) / (b ^ 3.0))) + ((-1.0 * (c / b)) + ((-0.25 * (((c ^ 4.0) * ((16.0 * (a ^ 4.0)) + (4.0 * (a ^ 4.0)))) / (a * (b ^ 7.0)))) + (-2.0 * (((c ^ 3.0) * (a ^ 2.0)) / (b ^ 5.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_] := N[(N[(-1.0 * N[(N[(N[Power[c, 2.0], $MachinePrecision] * a), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.25 * N[(N[(N[Power[c, 4.0], $MachinePrecision] * N[(N[(16.0 * N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision] + N[(4.0 * N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(N[(N[Power[c, 3.0], $MachinePrecision] * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
-1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + \left(-1 \cdot \frac{c}{b} + \left(-0.25 \cdot \frac{{c}^{4} \cdot \left(16 \cdot {a}^{4} + 4 \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 52.3

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5, \frac{{\left(\left(c \cdot c\right) \cdot \left(-2 \cdot \left(a \cdot a\right)\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{{b}^{7}}, \mathsf{fma}\left(-2, \left(c \cdot c\right) \cdot \left(a \cdot \frac{a}{{b}^{3}}\right), \mathsf{fma}\left(-4, \frac{{a}^{3}}{\frac{{b}^{5}}{{c}^{3}}}, a \cdot \left(-2 \cdot \frac{c}{b}\right)\right)\right)\right)} \cdot \frac{0.5}{a} \]
  5. Taylor expanded in c around 0 1.6

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

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

Reproduce

herbie shell --seed 2022203 
(FPCore (a b c)
  :name "Quadratic roots, 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) (* (* 4.0 a) c)))) (* 2.0 a)))