(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
(FPCore (a b c) :precision binary64 (+ (* (/ (* (pow c 3.0) (pow a 2.0)) (pow b 5.0)) -0.5625) (+ (* (/ (* (pow c 4.0) (pow a 3.0)) (pow b 7.0)) -1.0546875) (- (* (/ c b) -0.5) (* 0.375 (/ (* a (pow c 2.0)) (pow b 3.0)))))))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
double code(double a, double b, double c) {
return (((pow(c, 3.0) * pow(a, 2.0)) / pow(b, 5.0)) * -0.5625) + ((((pow(c, 4.0) * pow(a, 3.0)) / pow(b, 7.0)) * -1.0546875) + (((c / b) * -0.5) - (0.375 * ((a * pow(c, 2.0)) / pow(b, 3.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) - ((3.0d0 * a) * c)))) / (3.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 = ((((c ** 3.0d0) * (a ** 2.0d0)) / (b ** 5.0d0)) * (-0.5625d0)) + (((((c ** 4.0d0) * (a ** 3.0d0)) / (b ** 7.0d0)) * (-1.0546875d0)) + (((c / b) * (-0.5d0)) - (0.375d0 * ((a * (c ** 2.0d0)) / (b ** 3.0d0)))))
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
public static double code(double a, double b, double c) {
return (((Math.pow(c, 3.0) * Math.pow(a, 2.0)) / Math.pow(b, 5.0)) * -0.5625) + ((((Math.pow(c, 4.0) * Math.pow(a, 3.0)) / Math.pow(b, 7.0)) * -1.0546875) + (((c / b) * -0.5) - (0.375 * ((a * Math.pow(c, 2.0)) / Math.pow(b, 3.0)))));
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
def code(a, b, c): return (((math.pow(c, 3.0) * math.pow(a, 2.0)) / math.pow(b, 5.0)) * -0.5625) + ((((math.pow(c, 4.0) * math.pow(a, 3.0)) / math.pow(b, 7.0)) * -1.0546875) + (((c / b) * -0.5) - (0.375 * ((a * math.pow(c, 2.0)) / math.pow(b, 3.0)))))
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function code(a, b, c) return Float64(Float64(Float64(Float64((c ^ 3.0) * (a ^ 2.0)) / (b ^ 5.0)) * -0.5625) + Float64(Float64(Float64(Float64((c ^ 4.0) * (a ^ 3.0)) / (b ^ 7.0)) * -1.0546875) + Float64(Float64(Float64(c / b) * -0.5) - Float64(0.375 * Float64(Float64(a * (c ^ 2.0)) / (b ^ 3.0)))))) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
function tmp = code(a, b, c) tmp = ((((c ^ 3.0) * (a ^ 2.0)) / (b ^ 5.0)) * -0.5625) + (((((c ^ 4.0) * (a ^ 3.0)) / (b ^ 7.0)) * -1.0546875) + (((c / b) * -0.5) - (0.375 * ((a * (c ^ 2.0)) / (b ^ 3.0))))); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
code[a_, b_, c_] := N[(N[(N[(N[(N[Power[c, 3.0], $MachinePrecision] * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] * -0.5625), $MachinePrecision] + N[(N[(N[(N[(N[Power[c, 4.0], $MachinePrecision] * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision] * -1.0546875), $MachinePrecision] + N[(N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision] - N[(0.375 * N[(N[(a * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} \cdot -0.5625 + \left(\frac{{c}^{4} \cdot {a}^{3}}{{b}^{7}} \cdot -1.0546875 + \left(\frac{c}{b} \cdot -0.5 - 0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right)\right)



Bits error versus a



Bits error versus b



Bits error versus c
Results
Initial program 43.8
Simplified43.8
Taylor expanded in b around inf 3.1
Final simplification3.1
herbie shell --seed 2022148
(FPCore (a b c)
:name "Cubic critical, 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) (* (* 3.0 a) c)))) (* 3.0 a)))