
(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 10 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
(let* ((t_0 (* (pow a 4.0) (pow c 4.0))))
(/
(+
(* -0.5625 (/ (* (pow a 2.0) (pow c 3.0)) (pow b 4.0)))
(+
(+
(* -0.375 (/ (* a (pow c 2.0)) (pow b 2.0)))
(*
-0.16666666666666666
(/ (+ (* 1.265625 t_0) (* t_0 5.0625)) (* a (pow b 6.0)))))
(* c -0.5)))
b)))
double code(double a, double b, double c) {
double t_0 = pow(a, 4.0) * pow(c, 4.0);
return ((-0.5625 * ((pow(a, 2.0) * pow(c, 3.0)) / pow(b, 4.0))) + (((-0.375 * ((a * pow(c, 2.0)) / pow(b, 2.0))) + (-0.16666666666666666 * (((1.265625 * t_0) + (t_0 * 5.0625)) / (a * pow(b, 6.0))))) + (c * -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
real(8) :: t_0
t_0 = (a ** 4.0d0) * (c ** 4.0d0)
code = (((-0.5625d0) * (((a ** 2.0d0) * (c ** 3.0d0)) / (b ** 4.0d0))) + ((((-0.375d0) * ((a * (c ** 2.0d0)) / (b ** 2.0d0))) + ((-0.16666666666666666d0) * (((1.265625d0 * t_0) + (t_0 * 5.0625d0)) / (a * (b ** 6.0d0))))) + (c * (-0.5d0)))) / b
end function
public static double code(double a, double b, double c) {
double t_0 = Math.pow(a, 4.0) * Math.pow(c, 4.0);
return ((-0.5625 * ((Math.pow(a, 2.0) * Math.pow(c, 3.0)) / Math.pow(b, 4.0))) + (((-0.375 * ((a * Math.pow(c, 2.0)) / Math.pow(b, 2.0))) + (-0.16666666666666666 * (((1.265625 * t_0) + (t_0 * 5.0625)) / (a * Math.pow(b, 6.0))))) + (c * -0.5))) / b;
}
def code(a, b, c): t_0 = math.pow(a, 4.0) * math.pow(c, 4.0) return ((-0.5625 * ((math.pow(a, 2.0) * math.pow(c, 3.0)) / math.pow(b, 4.0))) + (((-0.375 * ((a * math.pow(c, 2.0)) / math.pow(b, 2.0))) + (-0.16666666666666666 * (((1.265625 * t_0) + (t_0 * 5.0625)) / (a * math.pow(b, 6.0))))) + (c * -0.5))) / b
function code(a, b, c) t_0 = Float64((a ^ 4.0) * (c ^ 4.0)) return Float64(Float64(Float64(-0.5625 * Float64(Float64((a ^ 2.0) * (c ^ 3.0)) / (b ^ 4.0))) + Float64(Float64(Float64(-0.375 * Float64(Float64(a * (c ^ 2.0)) / (b ^ 2.0))) + Float64(-0.16666666666666666 * Float64(Float64(Float64(1.265625 * t_0) + Float64(t_0 * 5.0625)) / Float64(a * (b ^ 6.0))))) + Float64(c * -0.5))) / b) end
function tmp = code(a, b, c) t_0 = (a ^ 4.0) * (c ^ 4.0); tmp = ((-0.5625 * (((a ^ 2.0) * (c ^ 3.0)) / (b ^ 4.0))) + (((-0.375 * ((a * (c ^ 2.0)) / (b ^ 2.0))) + (-0.16666666666666666 * (((1.265625 * t_0) + (t_0 * 5.0625)) / (a * (b ^ 6.0))))) + (c * -0.5))) / b; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[Power[a, 4.0], $MachinePrecision] * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(-0.5625 * N[(N[(N[Power[a, 2.0], $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-0.375 * N[(N[(a * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(N[(N[(1.265625 * t$95$0), $MachinePrecision] + N[(t$95$0 * 5.0625), $MachinePrecision]), $MachinePrecision] / N[(a * N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {a}^{4} \cdot {c}^{4}\\
\frac{-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(\left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + -0.16666666666666666 \cdot \frac{1.265625 \cdot t\_0 + t\_0 \cdot 5.0625}{a \cdot {b}^{6}}\right) + c \cdot -0.5\right)}{b}
\end{array}
\end{array}
Initial program 17.5%
Taylor expanded in b around inf 97.7%
Final simplification97.7%
(FPCore (a b c)
:precision binary64
(/
(*
c
(-
(*
c
(*
a
(+
(*
a
(+
(* -1.0546875 (/ (* a (pow c 2.0)) (pow b 6.0)))
(* -0.5625 (/ c (pow b 4.0)))))
(* 0.375 (/ -1.0 (pow b 2.0))))))
0.5))
b))
double code(double a, double b, double c) {
return (c * ((c * (a * ((a * ((-1.0546875 * ((a * pow(c, 2.0)) / pow(b, 6.0))) + (-0.5625 * (c / pow(b, 4.0))))) + (0.375 * (-1.0 / 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 * ((c * (a * ((a * (((-1.0546875d0) * ((a * (c ** 2.0d0)) / (b ** 6.0d0))) + ((-0.5625d0) * (c / (b ** 4.0d0))))) + (0.375d0 * ((-1.0d0) / (b ** 2.0d0)))))) - 0.5d0)) / b
end function
public static double code(double a, double b, double c) {
return (c * ((c * (a * ((a * ((-1.0546875 * ((a * Math.pow(c, 2.0)) / Math.pow(b, 6.0))) + (-0.5625 * (c / Math.pow(b, 4.0))))) + (0.375 * (-1.0 / Math.pow(b, 2.0)))))) - 0.5)) / b;
}
def code(a, b, c): return (c * ((c * (a * ((a * ((-1.0546875 * ((a * math.pow(c, 2.0)) / math.pow(b, 6.0))) + (-0.5625 * (c / math.pow(b, 4.0))))) + (0.375 * (-1.0 / math.pow(b, 2.0)))))) - 0.5)) / b
function code(a, b, c) return Float64(Float64(c * Float64(Float64(c * Float64(a * Float64(Float64(a * Float64(Float64(-1.0546875 * Float64(Float64(a * (c ^ 2.0)) / (b ^ 6.0))) + Float64(-0.5625 * Float64(c / (b ^ 4.0))))) + Float64(0.375 * Float64(-1.0 / (b ^ 2.0)))))) - 0.5)) / b) end
function tmp = code(a, b, c) tmp = (c * ((c * (a * ((a * ((-1.0546875 * ((a * (c ^ 2.0)) / (b ^ 6.0))) + (-0.5625 * (c / (b ^ 4.0))))) + (0.375 * (-1.0 / (b ^ 2.0)))))) - 0.5)) / b; end
code[a_, b_, c_] := N[(N[(c * N[(N[(c * N[(a * N[(N[(a * N[(N[(-1.0546875 * N[(N[(a * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5625 * N[(c / N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.375 * N[(-1.0 / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{c \cdot \left(c \cdot \left(a \cdot \left(a \cdot \left(-1.0546875 \cdot \frac{a \cdot {c}^{2}}{{b}^{6}} + -0.5625 \cdot \frac{c}{{b}^{4}}\right) + 0.375 \cdot \frac{-1}{{b}^{2}}\right)\right) - 0.5\right)}{b}
\end{array}
Initial program 17.5%
Taylor expanded in b around inf 97.7%
Taylor expanded in c around 0 97.6%
Taylor expanded in a around 0 97.6%
Taylor expanded in a around 0 97.6%
Final simplification97.6%
(FPCore (a b c)
:precision binary64
(+
(* -0.5 (/ c b))
(*
a
(+
(* -0.5625 (/ (* a (pow c 3.0)) (pow b 5.0)))
(* -0.375 (/ (pow c 2.0) (pow b 3.0)))))))
double code(double a, double b, double c) {
return (-0.5 * (c / b)) + (a * ((-0.5625 * ((a * pow(c, 3.0)) / pow(b, 5.0))) + (-0.375 * (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 = ((-0.5d0) * (c / b)) + (a * (((-0.5625d0) * ((a * (c ** 3.0d0)) / (b ** 5.0d0))) + ((-0.375d0) * ((c ** 2.0d0) / (b ** 3.0d0)))))
end function
public static double code(double a, double b, double c) {
return (-0.5 * (c / b)) + (a * ((-0.5625 * ((a * Math.pow(c, 3.0)) / Math.pow(b, 5.0))) + (-0.375 * (Math.pow(c, 2.0) / Math.pow(b, 3.0)))));
}
def code(a, b, c): return (-0.5 * (c / b)) + (a * ((-0.5625 * ((a * math.pow(c, 3.0)) / math.pow(b, 5.0))) + (-0.375 * (math.pow(c, 2.0) / math.pow(b, 3.0)))))
function code(a, b, c) return Float64(Float64(-0.5 * Float64(c / b)) + Float64(a * Float64(Float64(-0.5625 * Float64(Float64(a * (c ^ 3.0)) / (b ^ 5.0))) + Float64(-0.375 * Float64((c ^ 2.0) / (b ^ 3.0)))))) end
function tmp = code(a, b, c) tmp = (-0.5 * (c / b)) + (a * ((-0.5625 * ((a * (c ^ 3.0)) / (b ^ 5.0))) + (-0.375 * ((c ^ 2.0) / (b ^ 3.0))))); end
code[a_, b_, c_] := N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(-0.5625 * N[(N[(a * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.5625 \cdot \frac{a \cdot {c}^{3}}{{b}^{5}} + -0.375 \cdot \frac{{c}^{2}}{{b}^{3}}\right)
\end{array}
Initial program 17.5%
Taylor expanded in a around 0 96.9%
(FPCore (a b c)
:precision binary64
(/
(*
c
(-
(* c (* a (- (* -0.5625 (/ (* a c) (pow b 4.0))) (/ 0.375 (pow b 2.0)))))
0.5))
b))
double code(double a, double b, double c) {
return (c * ((c * (a * ((-0.5625 * ((a * c) / pow(b, 4.0))) - (0.375 / 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 * ((c * (a * (((-0.5625d0) * ((a * c) / (b ** 4.0d0))) - (0.375d0 / (b ** 2.0d0))))) - 0.5d0)) / b
end function
public static double code(double a, double b, double c) {
return (c * ((c * (a * ((-0.5625 * ((a * c) / Math.pow(b, 4.0))) - (0.375 / Math.pow(b, 2.0))))) - 0.5)) / b;
}
def code(a, b, c): return (c * ((c * (a * ((-0.5625 * ((a * c) / math.pow(b, 4.0))) - (0.375 / math.pow(b, 2.0))))) - 0.5)) / b
function code(a, b, c) return Float64(Float64(c * Float64(Float64(c * Float64(a * Float64(Float64(-0.5625 * Float64(Float64(a * c) / (b ^ 4.0))) - Float64(0.375 / (b ^ 2.0))))) - 0.5)) / b) end
function tmp = code(a, b, c) tmp = (c * ((c * (a * ((-0.5625 * ((a * c) / (b ^ 4.0))) - (0.375 / (b ^ 2.0))))) - 0.5)) / b; end
code[a_, b_, c_] := N[(N[(c * N[(N[(c * N[(a * N[(N[(-0.5625 * N[(N[(a * c), $MachinePrecision] / N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.375 / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{c \cdot \left(c \cdot \left(a \cdot \left(-0.5625 \cdot \frac{a \cdot c}{{b}^{4}} - \frac{0.375}{{b}^{2}}\right)\right) - 0.5\right)}{b}
\end{array}
Initial program 17.5%
Taylor expanded in b around inf 97.7%
Taylor expanded in c around 0 97.6%
Taylor expanded in a around 0 97.6%
Taylor expanded in a around 0 96.8%
associate-*r/96.8%
metadata-eval96.8%
Simplified96.8%
(FPCore (a b c) :precision binary64 (+ (* -0.5 (/ c b)) (* -0.375 (/ (* a (pow c 2.0)) (pow b 3.0)))))
double code(double a, double b, double c) {
return (-0.5 * (c / b)) + (-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 = ((-0.5d0) * (c / b)) + ((-0.375d0) * ((a * (c ** 2.0d0)) / (b ** 3.0d0)))
end function
public static double code(double a, double b, double c) {
return (-0.5 * (c / b)) + (-0.375 * ((a * Math.pow(c, 2.0)) / Math.pow(b, 3.0)));
}
def code(a, b, c): return (-0.5 * (c / b)) + (-0.375 * ((a * math.pow(c, 2.0)) / math.pow(b, 3.0)))
function code(a, b, c) return Float64(Float64(-0.5 * Float64(c / b)) + Float64(-0.375 * Float64(Float64(a * (c ^ 2.0)) / (b ^ 3.0)))) end
function tmp = code(a, b, c) tmp = (-0.5 * (c / b)) + (-0.375 * ((a * (c ^ 2.0)) / (b ^ 3.0))); end
code[a_, b_, c_] := N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(N[(a * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}
\end{array}
Initial program 17.5%
Taylor expanded in a around 0 95.4%
(FPCore (a b c) :precision binary64 (/ (fma -0.375 (* a (pow (/ c b) 2.0)) (* c -0.5)) b))
double code(double a, double b, double c) {
return fma(-0.375, (a * pow((c / b), 2.0)), (c * -0.5)) / b;
}
function code(a, b, c) return Float64(fma(-0.375, Float64(a * (Float64(c / b) ^ 2.0)), Float64(c * -0.5)) / b) end
code[a_, b_, c_] := N[(N[(-0.375 * N[(a * N[Power[N[(c / b), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(c * -0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(-0.375, a \cdot {\left(\frac{c}{b}\right)}^{2}, c \cdot -0.5\right)}{b}
\end{array}
Initial program 17.5%
Taylor expanded in a around 0 95.4%
Taylor expanded in b around inf 95.4%
+-commutative95.4%
associate-*r/95.4%
*-commutative95.4%
fma-define95.4%
unpow295.4%
unpow295.4%
times-frac95.4%
unpow195.4%
pow-plus95.4%
metadata-eval95.4%
Simplified95.4%
(FPCore (a b c) :precision binary64 (/ (* c (- (* -0.375 (/ (* a c) (pow b 2.0))) 0.5)) b))
double code(double a, double b, double c) {
return (c * ((-0.375 * ((a * c) / 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) * ((a * c) / (b ** 2.0d0))) - 0.5d0)) / b
end function
public static double code(double a, double b, double c) {
return (c * ((-0.375 * ((a * c) / Math.pow(b, 2.0))) - 0.5)) / b;
}
def code(a, b, c): return (c * ((-0.375 * ((a * c) / math.pow(b, 2.0))) - 0.5)) / b
function code(a, b, c) return Float64(Float64(c * Float64(Float64(-0.375 * Float64(Float64(a * c) / (b ^ 2.0))) - 0.5)) / b) end
function tmp = code(a, b, c) tmp = (c * ((-0.375 * ((a * c) / (b ^ 2.0))) - 0.5)) / b; end
code[a_, b_, c_] := N[(N[(c * N[(N[(-0.375 * N[(N[(a * c), $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{a \cdot c}{{b}^{2}} - 0.5\right)}{b}
\end{array}
Initial program 17.5%
Taylor expanded in b around inf 97.7%
Taylor expanded in c around 0 95.4%
(FPCore (a b c) :precision binary64 (* c (- (* -0.375 (* a (/ c (pow b 3.0)))) (/ 0.5 b))))
double code(double a, double b, double c) {
return c * ((-0.375 * (a * (c / 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) * (a * (c / (b ** 3.0d0)))) - (0.5d0 / b))
end function
public static double code(double a, double b, double c) {
return c * ((-0.375 * (a * (c / Math.pow(b, 3.0)))) - (0.5 / b));
}
def code(a, b, c): return c * ((-0.375 * (a * (c / math.pow(b, 3.0)))) - (0.5 / b))
function code(a, b, c) return Float64(c * Float64(Float64(-0.375 * Float64(a * Float64(c / (b ^ 3.0)))) - Float64(0.5 / b))) end
function tmp = code(a, b, c) tmp = c * ((-0.375 * (a * (c / (b ^ 3.0)))) - (0.5 / b)); end
code[a_, b_, c_] := N[(c * N[(N[(-0.375 * N[(a * N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c \cdot \left(-0.375 \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) - \frac{0.5}{b}\right)
\end{array}
Initial program 17.5%
Taylor expanded in a around 0 95.4%
Taylor expanded in c around 0 95.1%
associate-/l*95.1%
associate-*r/95.1%
metadata-eval95.1%
Simplified95.1%
(FPCore (a b c) :precision binary64 (/ (* c -0.5) b))
double code(double a, double b, double c) {
return (c * -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.5d0)) / b
end function
public static double code(double a, double b, double c) {
return (c * -0.5) / b;
}
def code(a, b, c): return (c * -0.5) / b
function code(a, b, c) return Float64(Float64(c * -0.5) / b) end
function tmp = code(a, b, c) tmp = (c * -0.5) / b; end
code[a_, b_, c_] := N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{c \cdot -0.5}{b}
\end{array}
Initial program 17.5%
Taylor expanded in b around inf 90.5%
associate-*r/90.5%
*-commutative90.5%
Simplified90.5%
(FPCore (a b c) :precision binary64 (* c (/ -0.5 b)))
double code(double a, double b, double c) {
return c * (-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.5d0) / b)
end function
public static double code(double a, double b, double c) {
return c * (-0.5 / b);
}
def code(a, b, c): return c * (-0.5 / b)
function code(a, b, c) return Float64(c * Float64(-0.5 / b)) end
function tmp = code(a, b, c) tmp = c * (-0.5 / b); end
code[a_, b_, c_] := N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c \cdot \frac{-0.5}{b}
\end{array}
Initial program 17.5%
Taylor expanded in b around inf 90.5%
associate-*r/90.5%
*-commutative90.5%
Simplified90.5%
Taylor expanded in c around 0 90.5%
*-commutative90.5%
associate-*l/90.5%
associate-*r/90.2%
Simplified90.2%
herbie shell --seed 2024112
(FPCore (a b c)
:name "Cubic critical, 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) (* (* 3.0 a) c)))) (* 3.0 a)))