
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.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) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
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);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
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 tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); 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]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.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) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
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);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
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 tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); 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]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(/
(+
(* -0.5 c)
(*
a
(+
(* -0.375 (/ (pow c 2.0) (pow b 2.0)))
(*
a
(+
(* -1.0546875 (/ (* a (pow c 4.0)) (pow b 6.0)))
(* -0.5625 (/ (pow c 3.0) (pow b 4.0))))))))
b))
double code(double a, double b, double c) {
return ((-0.5 * c) + (a * ((-0.375 * (pow(c, 2.0) / pow(b, 2.0))) + (a * ((-1.0546875 * ((a * pow(c, 4.0)) / pow(b, 6.0))) + (-0.5625 * (pow(c, 3.0) / pow(b, 4.0)))))))) / b;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (((-0.5d0) * c) + (a * (((-0.375d0) * ((c ** 2.0d0) / (b ** 2.0d0))) + (a * (((-1.0546875d0) * ((a * (c ** 4.0d0)) / (b ** 6.0d0))) + ((-0.5625d0) * ((c ** 3.0d0) / (b ** 4.0d0)))))))) / b
end function
public static double code(double a, double b, double c) {
return ((-0.5 * c) + (a * ((-0.375 * (Math.pow(c, 2.0) / Math.pow(b, 2.0))) + (a * ((-1.0546875 * ((a * Math.pow(c, 4.0)) / Math.pow(b, 6.0))) + (-0.5625 * (Math.pow(c, 3.0) / Math.pow(b, 4.0)))))))) / b;
}
def code(a, b, c): return ((-0.5 * c) + (a * ((-0.375 * (math.pow(c, 2.0) / math.pow(b, 2.0))) + (a * ((-1.0546875 * ((a * math.pow(c, 4.0)) / math.pow(b, 6.0))) + (-0.5625 * (math.pow(c, 3.0) / math.pow(b, 4.0)))))))) / b
function code(a, b, c) return Float64(Float64(Float64(-0.5 * c) + Float64(a * Float64(Float64(-0.375 * Float64((c ^ 2.0) / (b ^ 2.0))) + Float64(a * Float64(Float64(-1.0546875 * Float64(Float64(a * (c ^ 4.0)) / (b ^ 6.0))) + Float64(-0.5625 * Float64((c ^ 3.0) / (b ^ 4.0)))))))) / b) end
function tmp = code(a, b, c) tmp = ((-0.5 * c) + (a * ((-0.375 * ((c ^ 2.0) / (b ^ 2.0))) + (a * ((-1.0546875 * ((a * (c ^ 4.0)) / (b ^ 6.0))) + (-0.5625 * ((c ^ 3.0) / (b ^ 4.0)))))))) / b; end
code[a_, b_, c_] := N[(N[(N[(-0.5 * c), $MachinePrecision] + N[(a * N[(N[(-0.375 * N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(-1.0546875 * N[(N[(a * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5625 * N[(N[Power[c, 3.0], $MachinePrecision] / N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.5 \cdot c + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{2}} + a \cdot \left(-1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{6}} + -0.5625 \cdot \frac{{c}^{3}}{{b}^{4}}\right)\right)}{b}
\end{array}
Initial program 30.5%
Simplified30.4%
Taylor expanded in b around inf 96.6%
Taylor expanded in a around -inf 96.1%
Simplified96.1%
Taylor expanded in a around 0 96.6%
(FPCore (a b c)
:precision binary64
(/
(*
c
(-
(*
c
(+
(* -0.375 (/ a (pow b 2.0)))
(*
c
(+
(* -1.0546875 (/ (* c (pow a 3.0)) (pow b 6.0)))
(* -0.5625 (/ (pow a 2.0) (pow b 4.0)))))))
0.5))
b))
double code(double a, double b, double c) {
return (c * ((c * ((-0.375 * (a / pow(b, 2.0))) + (c * ((-1.0546875 * ((c * pow(a, 3.0)) / pow(b, 6.0))) + (-0.5625 * (pow(a, 2.0) / pow(b, 4.0))))))) - 0.5)) / b;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (c * ((c * (((-0.375d0) * (a / (b ** 2.0d0))) + (c * (((-1.0546875d0) * ((c * (a ** 3.0d0)) / (b ** 6.0d0))) + ((-0.5625d0) * ((a ** 2.0d0) / (b ** 4.0d0))))))) - 0.5d0)) / b
end function
public static double code(double a, double b, double c) {
return (c * ((c * ((-0.375 * (a / Math.pow(b, 2.0))) + (c * ((-1.0546875 * ((c * Math.pow(a, 3.0)) / Math.pow(b, 6.0))) + (-0.5625 * (Math.pow(a, 2.0) / Math.pow(b, 4.0))))))) - 0.5)) / b;
}
def code(a, b, c): return (c * ((c * ((-0.375 * (a / math.pow(b, 2.0))) + (c * ((-1.0546875 * ((c * math.pow(a, 3.0)) / math.pow(b, 6.0))) + (-0.5625 * (math.pow(a, 2.0) / math.pow(b, 4.0))))))) - 0.5)) / b
function code(a, b, c) return Float64(Float64(c * Float64(Float64(c * Float64(Float64(-0.375 * Float64(a / (b ^ 2.0))) + Float64(c * Float64(Float64(-1.0546875 * Float64(Float64(c * (a ^ 3.0)) / (b ^ 6.0))) + Float64(-0.5625 * Float64((a ^ 2.0) / (b ^ 4.0))))))) - 0.5)) / b) end
function tmp = code(a, b, c) tmp = (c * ((c * ((-0.375 * (a / (b ^ 2.0))) + (c * ((-1.0546875 * ((c * (a ^ 3.0)) / (b ^ 6.0))) + (-0.5625 * ((a ^ 2.0) / (b ^ 4.0))))))) - 0.5)) / b; end
code[a_, b_, c_] := N[(N[(c * N[(N[(c * N[(N[(-0.375 * N[(a / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * N[(N[(-1.0546875 * N[(N[(c * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5625 * N[(N[Power[a, 2.0], $MachinePrecision] / N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{c \cdot \left(c \cdot \left(-0.375 \cdot \frac{a}{{b}^{2}} + c \cdot \left(-1.0546875 \cdot \frac{c \cdot {a}^{3}}{{b}^{6}} + -0.5625 \cdot \frac{{a}^{2}}{{b}^{4}}\right)\right) - 0.5\right)}{b}
\end{array}
Initial program 30.5%
Simplified30.4%
Taylor expanded in b around inf 96.6%
Taylor expanded in a around -inf 96.1%
Simplified96.1%
Taylor expanded in c around 0 96.4%
Final simplification96.4%
(FPCore (a b c)
:precision binary64
(*
c
(+
(*
c
(+
(* -0.375 (/ a (pow b 3.0)))
(*
c
(*
(pow a 3.0)
(- (/ (* c -1.0546875) (pow b 7.0)) (/ 0.5625 (* a (pow b 5.0))))))))
(* 0.5 (/ -1.0 b)))))
double code(double a, double b, double c) {
return c * ((c * ((-0.375 * (a / pow(b, 3.0))) + (c * (pow(a, 3.0) * (((c * -1.0546875) / pow(b, 7.0)) - (0.5625 / (a * pow(b, 5.0)))))))) + (0.5 * (-1.0 / b)));
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c * ((c * (((-0.375d0) * (a / (b ** 3.0d0))) + (c * ((a ** 3.0d0) * (((c * (-1.0546875d0)) / (b ** 7.0d0)) - (0.5625d0 / (a * (b ** 5.0d0)))))))) + (0.5d0 * ((-1.0d0) / b)))
end function
public static double code(double a, double b, double c) {
return c * ((c * ((-0.375 * (a / Math.pow(b, 3.0))) + (c * (Math.pow(a, 3.0) * (((c * -1.0546875) / Math.pow(b, 7.0)) - (0.5625 / (a * Math.pow(b, 5.0)))))))) + (0.5 * (-1.0 / b)));
}
def code(a, b, c): return c * ((c * ((-0.375 * (a / math.pow(b, 3.0))) + (c * (math.pow(a, 3.0) * (((c * -1.0546875) / math.pow(b, 7.0)) - (0.5625 / (a * math.pow(b, 5.0)))))))) + (0.5 * (-1.0 / b)))
function code(a, b, c) return Float64(c * Float64(Float64(c * Float64(Float64(-0.375 * Float64(a / (b ^ 3.0))) + Float64(c * Float64((a ^ 3.0) * Float64(Float64(Float64(c * -1.0546875) / (b ^ 7.0)) - Float64(0.5625 / Float64(a * (b ^ 5.0)))))))) + Float64(0.5 * Float64(-1.0 / b)))) end
function tmp = code(a, b, c) tmp = c * ((c * ((-0.375 * (a / (b ^ 3.0))) + (c * ((a ^ 3.0) * (((c * -1.0546875) / (b ^ 7.0)) - (0.5625 / (a * (b ^ 5.0)))))))) + (0.5 * (-1.0 / b))); end
code[a_, b_, c_] := N[(c * N[(N[(c * N[(N[(-0.375 * N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * N[(N[Power[a, 3.0], $MachinePrecision] * N[(N[(N[(c * -1.0546875), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision] - N[(0.5625 / N[(a * N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c \cdot \left(c \cdot \left(-0.375 \cdot \frac{a}{{b}^{3}} + c \cdot \left({a}^{3} \cdot \left(\frac{c \cdot -1.0546875}{{b}^{7}} - \frac{0.5625}{a \cdot {b}^{5}}\right)\right)\right) + 0.5 \cdot \frac{-1}{b}\right)
\end{array}
Initial program 30.5%
Simplified30.4%
Taylor expanded in b around inf 96.6%
Taylor expanded in c around 0 96.3%
Taylor expanded in a around 0 96.3%
Taylor expanded in a around inf 96.3%
associate-*r/96.3%
associate-*r/96.3%
metadata-eval96.3%
Simplified96.3%
Final simplification96.3%
(FPCore (a b c)
:precision binary64
(+
(* -0.5 (/ c b))
(*
a
(*
(pow c 3.0)
(- (* -0.5625 (/ a (pow b 5.0))) (/ 0.375 (* c (pow b 3.0))))))))
double code(double a, double b, double c) {
return (-0.5 * (c / b)) + (a * (pow(c, 3.0) * ((-0.5625 * (a / pow(b, 5.0))) - (0.375 / (c * 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 = ((-0.5d0) * (c / b)) + (a * ((c ** 3.0d0) * (((-0.5625d0) * (a / (b ** 5.0d0))) - (0.375d0 / (c * (b ** 3.0d0))))))
end function
public static double code(double a, double b, double c) {
return (-0.5 * (c / b)) + (a * (Math.pow(c, 3.0) * ((-0.5625 * (a / Math.pow(b, 5.0))) - (0.375 / (c * Math.pow(b, 3.0))))));
}
def code(a, b, c): return (-0.5 * (c / b)) + (a * (math.pow(c, 3.0) * ((-0.5625 * (a / math.pow(b, 5.0))) - (0.375 / (c * math.pow(b, 3.0))))))
function code(a, b, c) return Float64(Float64(-0.5 * Float64(c / b)) + Float64(a * Float64((c ^ 3.0) * Float64(Float64(-0.5625 * Float64(a / (b ^ 5.0))) - Float64(0.375 / Float64(c * (b ^ 3.0))))))) end
function tmp = code(a, b, c) tmp = (-0.5 * (c / b)) + (a * ((c ^ 3.0) * ((-0.5625 * (a / (b ^ 5.0))) - (0.375 / (c * (b ^ 3.0)))))); end
code[a_, b_, c_] := N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Power[c, 3.0], $MachinePrecision] * N[(N[(-0.5625 * N[(a / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.375 / N[(c * N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \frac{c}{b} + a \cdot \left({c}^{3} \cdot \left(-0.5625 \cdot \frac{a}{{b}^{5}} - \frac{0.375}{c \cdot {b}^{3}}\right)\right)
\end{array}
Initial program 30.5%
Simplified30.4%
Taylor expanded in a around 0 94.9%
Taylor expanded in c around inf 94.9%
associate-*r/94.9%
metadata-eval94.9%
*-commutative94.9%
Simplified94.9%
(FPCore (a b c) :precision binary64 (* c (+ (* c (* a (- (/ (* -0.5625 (* c a)) (pow b 5.0)) (/ 0.375 (pow b 3.0))))) (* 0.5 (/ -1.0 b)))))
double code(double a, double b, double c) {
return c * ((c * (a * (((-0.5625 * (c * a)) / pow(b, 5.0)) - (0.375 / pow(b, 3.0))))) + (0.5 * (-1.0 / b)));
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c * ((c * (a * ((((-0.5625d0) * (c * a)) / (b ** 5.0d0)) - (0.375d0 / (b ** 3.0d0))))) + (0.5d0 * ((-1.0d0) / b)))
end function
public static double code(double a, double b, double c) {
return c * ((c * (a * (((-0.5625 * (c * a)) / Math.pow(b, 5.0)) - (0.375 / Math.pow(b, 3.0))))) + (0.5 * (-1.0 / b)));
}
def code(a, b, c): return c * ((c * (a * (((-0.5625 * (c * a)) / math.pow(b, 5.0)) - (0.375 / math.pow(b, 3.0))))) + (0.5 * (-1.0 / b)))
function code(a, b, c) return Float64(c * Float64(Float64(c * Float64(a * Float64(Float64(Float64(-0.5625 * Float64(c * a)) / (b ^ 5.0)) - Float64(0.375 / (b ^ 3.0))))) + Float64(0.5 * Float64(-1.0 / b)))) end
function tmp = code(a, b, c) tmp = c * ((c * (a * (((-0.5625 * (c * a)) / (b ^ 5.0)) - (0.375 / (b ^ 3.0))))) + (0.5 * (-1.0 / b))); end
code[a_, b_, c_] := N[(c * N[(N[(c * N[(a * N[(N[(N[(-0.5625 * N[(c * a), $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] - N[(0.375 / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c \cdot \left(c \cdot \left(a \cdot \left(\frac{-0.5625 \cdot \left(c \cdot a\right)}{{b}^{5}} - \frac{0.375}{{b}^{3}}\right)\right) + 0.5 \cdot \frac{-1}{b}\right)
\end{array}
Initial program 30.5%
Simplified30.4%
Taylor expanded in b around inf 96.6%
Taylor expanded in c around 0 96.3%
Taylor expanded in a around 0 96.3%
Taylor expanded in a around 0 94.6%
associate-*r/94.6%
associate-*r/94.6%
metadata-eval94.6%
Simplified94.6%
Final simplification94.6%
(FPCore (a b c) :precision binary64 (/ (fma -0.5 c (* (* a -0.375) (pow (/ c b) 2.0))) b))
double code(double a, double b, double c) {
return fma(-0.5, c, ((a * -0.375) * pow((c / b), 2.0))) / b;
}
function code(a, b, c) return Float64(fma(-0.5, c, Float64(Float64(a * -0.375) * (Float64(c / b) ^ 2.0))) / b) end
code[a_, b_, c_] := N[(N[(-0.5 * c + N[(N[(a * -0.375), $MachinePrecision] * N[Power[N[(c / b), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(-0.5, c, \left(a \cdot -0.375\right) \cdot {\left(\frac{c}{b}\right)}^{2}\right)}{b}
\end{array}
Initial program 30.5%
Simplified30.4%
Taylor expanded in b around inf 96.6%
Taylor expanded in b around inf 91.7%
fma-define91.7%
associate-*r/91.7%
associate-*r*91.7%
unpow291.7%
unpow291.7%
times-frac91.7%
unpow191.7%
pow-plus91.7%
metadata-eval91.7%
Simplified91.7%
Final simplification91.7%
(FPCore (a b c) :precision binary64 (/ (* c (- (* -0.375 (/ (* c a) (pow b 2.0))) 0.5)) b))
double code(double a, double b, double c) {
return (c * ((-0.375 * ((c * a) / pow(b, 2.0))) - 0.5)) / b;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (c * (((-0.375d0) * ((c * a) / (b ** 2.0d0))) - 0.5d0)) / b
end function
public static double code(double a, double b, double c) {
return (c * ((-0.375 * ((c * a) / Math.pow(b, 2.0))) - 0.5)) / b;
}
def code(a, b, c): return (c * ((-0.375 * ((c * a) / math.pow(b, 2.0))) - 0.5)) / b
function code(a, b, c) return Float64(Float64(c * Float64(Float64(-0.375 * Float64(Float64(c * a) / (b ^ 2.0))) - 0.5)) / b) end
function tmp = code(a, b, c) tmp = (c * ((-0.375 * ((c * a) / (b ^ 2.0))) - 0.5)) / b; end
code[a_, b_, c_] := N[(N[(c * N[(N[(-0.375 * N[(N[(c * a), $MachinePrecision] / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{c \cdot \left(-0.375 \cdot \frac{c \cdot a}{{b}^{2}} - 0.5\right)}{b}
\end{array}
Initial program 30.5%
Simplified30.4%
Taylor expanded in b around inf 96.6%
Taylor expanded in c around 0 91.6%
Final simplification91.6%
(FPCore (a b c) :precision binary64 (* c (- (* -0.375 (/ (* c a) (pow b 3.0))) (/ 0.5 b))))
double code(double a, double b, double c) {
return c * ((-0.375 * ((c * a) / pow(b, 3.0))) - (0.5 / b));
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c * (((-0.375d0) * ((c * a) / (b ** 3.0d0))) - (0.5d0 / b))
end function
public static double code(double a, double b, double c) {
return c * ((-0.375 * ((c * a) / Math.pow(b, 3.0))) - (0.5 / b));
}
def code(a, b, c): return c * ((-0.375 * ((c * a) / math.pow(b, 3.0))) - (0.5 / b))
function code(a, b, c) return Float64(c * Float64(Float64(-0.375 * Float64(Float64(c * a) / (b ^ 3.0))) - Float64(0.5 / b))) end
function tmp = code(a, b, c) tmp = c * ((-0.375 * ((c * a) / (b ^ 3.0))) - (0.5 / b)); end
code[a_, b_, c_] := N[(c * N[(N[(-0.375 * N[(N[(c * a), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c \cdot \left(-0.375 \cdot \frac{c \cdot a}{{b}^{3}} - \frac{0.5}{b}\right)
\end{array}
Initial program 30.5%
Simplified30.4%
Taylor expanded in c around 0 91.4%
associate-*r/91.4%
metadata-eval91.4%
Simplified91.4%
Final simplification91.4%
(FPCore (a b c) :precision binary64 (* -0.5 (/ c b)))
double code(double a, double b, double c) {
return -0.5 * (c / b);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-0.5d0) * (c / b)
end function
public static double code(double a, double b, double c) {
return -0.5 * (c / b);
}
def code(a, b, c): return -0.5 * (c / b)
function code(a, b, c) return Float64(-0.5 * Float64(c / b)) end
function tmp = code(a, b, c) tmp = -0.5 * (c / b); end
code[a_, b_, c_] := N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \frac{c}{b}
\end{array}
Initial program 30.5%
Simplified30.4%
Taylor expanded in b around inf 82.4%
herbie shell --seed 2024170
(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)))