
(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 13 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 (fma b b (* c (* -3.0 a)))))
(if (<= b 1.5)
(* (/ (- t_0 (* b b)) (+ b (sqrt t_0))) (/ 0.3333333333333333 a))
(fma
-0.5625
(/ (pow c 3.0) (/ (pow b 5.0) (* a a)))
(fma
-0.16666666666666666
(* (/ (pow (* c a) 4.0) (pow b 7.0)) (/ 6.328125 a))
(fma -0.5 (/ c b) (* -0.375 (/ (* a (* c c)) (pow b 3.0)))))))))
double code(double a, double b, double c) {
double t_0 = fma(b, b, (c * (-3.0 * a)));
double tmp;
if (b <= 1.5) {
tmp = ((t_0 - (b * b)) / (b + sqrt(t_0))) * (0.3333333333333333 / a);
} else {
tmp = fma(-0.5625, (pow(c, 3.0) / (pow(b, 5.0) / (a * a))), fma(-0.16666666666666666, ((pow((c * a), 4.0) / pow(b, 7.0)) * (6.328125 / a)), fma(-0.5, (c / b), (-0.375 * ((a * (c * c)) / pow(b, 3.0))))));
}
return tmp;
}
function code(a, b, c) t_0 = fma(b, b, Float64(c * Float64(-3.0 * a))) tmp = 0.0 if (b <= 1.5) tmp = Float64(Float64(Float64(t_0 - Float64(b * b)) / Float64(b + sqrt(t_0))) * Float64(0.3333333333333333 / a)); else tmp = fma(-0.5625, Float64((c ^ 3.0) / Float64((b ^ 5.0) / Float64(a * a))), fma(-0.16666666666666666, Float64(Float64((Float64(c * a) ^ 4.0) / (b ^ 7.0)) * Float64(6.328125 / a)), fma(-0.5, Float64(c / b), Float64(-0.375 * Float64(Float64(a * Float64(c * c)) / (b ^ 3.0)))))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(b * b + N[(c * N[(-3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.5], N[(N[(N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5625 * N[(N[Power[c, 3.0], $MachinePrecision] / N[(N[Power[b, 5.0], $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(N[(N[Power[N[(c * a), $MachinePrecision], 4.0], $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision] * N[(6.328125 / a), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision] + N[(-0.375 * N[(N[(a * N[(c * c), $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(b, b, c \cdot \left(-3 \cdot a\right)\right)\\
\mathbf{if}\;b \leq 1.5:\\
\;\;\;\;\frac{t_0 - b \cdot b}{b + \sqrt{t_0}} \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.16666666666666666, \frac{{\left(c \cdot a\right)}^{4}}{{b}^{7}} \cdot \frac{6.328125}{a}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right)\right)\right)\\
\end{array}
\end{array}
if b < 1.5Initial program 86.0%
neg-sub086.0%
associate-+l-86.0%
sub0-neg86.0%
neg-mul-186.0%
associate-*r/86.0%
*-commutative86.0%
metadata-eval86.0%
metadata-eval86.0%
times-frac86.0%
*-commutative86.0%
times-frac85.9%
Simplified86.4%
add-cube-cbrt86.1%
pow386.2%
Applied egg-rr86.2%
flip--85.8%
add-sqr-sqrt86.8%
unpow386.8%
add-cube-cbrt87.0%
unpow386.9%
add-cube-cbrt86.9%
Applied egg-rr86.9%
*-commutative86.9%
associate-*l*86.9%
+-commutative86.9%
*-commutative86.9%
associate-*l*86.9%
Simplified86.9%
if 1.5 < b Initial program 50.8%
/-rgt-identity50.8%
metadata-eval50.8%
associate-/l*50.8%
associate-*r/50.8%
*-commutative50.8%
associate-*l/50.8%
associate-*r/50.8%
metadata-eval50.8%
metadata-eval50.8%
times-frac50.8%
neg-mul-150.8%
distribute-rgt-neg-in50.8%
times-frac50.8%
metadata-eval50.8%
neg-mul-150.8%
Simplified50.9%
Taylor expanded in b around inf 94.4%
fma-def94.4%
associate-/l*94.4%
unpow294.4%
fma-def94.4%
Simplified94.4%
Taylor expanded in c around 0 94.4%
*-commutative94.4%
distribute-rgt-out94.4%
associate-*r*94.4%
times-frac94.4%
Simplified94.4%
Final simplification93.0%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma b b (* c (* -3.0 a)))))
(if (<= b 8.0)
(* (/ (- t_0 (* b b)) (+ b (sqrt t_0))) (/ 0.3333333333333333 a))
(fma
-0.5625
(/ (pow c 3.0) (/ (pow b 5.0) (* a a)))
(fma -0.375 (/ (* c c) (/ (pow b 3.0) a)) (/ (* c -0.5) b))))))
double code(double a, double b, double c) {
double t_0 = fma(b, b, (c * (-3.0 * a)));
double tmp;
if (b <= 8.0) {
tmp = ((t_0 - (b * b)) / (b + sqrt(t_0))) * (0.3333333333333333 / a);
} else {
tmp = fma(-0.5625, (pow(c, 3.0) / (pow(b, 5.0) / (a * a))), fma(-0.375, ((c * c) / (pow(b, 3.0) / a)), ((c * -0.5) / b)));
}
return tmp;
}
function code(a, b, c) t_0 = fma(b, b, Float64(c * Float64(-3.0 * a))) tmp = 0.0 if (b <= 8.0) tmp = Float64(Float64(Float64(t_0 - Float64(b * b)) / Float64(b + sqrt(t_0))) * Float64(0.3333333333333333 / a)); else tmp = fma(-0.5625, Float64((c ^ 3.0) / Float64((b ^ 5.0) / Float64(a * a))), fma(-0.375, Float64(Float64(c * c) / Float64((b ^ 3.0) / a)), Float64(Float64(c * -0.5) / b))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(b * b + N[(c * N[(-3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 8.0], N[(N[(N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5625 * N[(N[Power[c, 3.0], $MachinePrecision] / N[(N[Power[b, 5.0], $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(N[(c * c), $MachinePrecision] / N[(N[Power[b, 3.0], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(b, b, c \cdot \left(-3 \cdot a\right)\right)\\
\mathbf{if}\;b \leq 8:\\
\;\;\;\;\frac{t_0 - b \cdot b}{b + \sqrt{t_0}} \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, \frac{c \cdot -0.5}{b}\right)\right)\\
\end{array}
\end{array}
if b < 8Initial program 83.8%
neg-sub083.8%
associate-+l-83.8%
sub0-neg83.8%
neg-mul-183.8%
associate-*r/83.8%
*-commutative83.8%
metadata-eval83.8%
metadata-eval83.8%
times-frac83.8%
*-commutative83.8%
times-frac83.7%
Simplified84.0%
add-cube-cbrt83.8%
pow383.9%
Applied egg-rr83.9%
flip--83.6%
add-sqr-sqrt84.7%
unpow384.7%
add-cube-cbrt84.9%
unpow384.9%
add-cube-cbrt84.9%
Applied egg-rr84.9%
*-commutative84.9%
associate-*l*84.9%
+-commutative84.9%
*-commutative84.9%
associate-*l*84.9%
Simplified84.9%
if 8 < b Initial program 49.0%
/-rgt-identity49.0%
metadata-eval49.0%
associate-/l*49.0%
associate-*r/49.0%
*-commutative49.0%
associate-*l/49.0%
associate-*r/49.0%
metadata-eval49.0%
metadata-eval49.0%
times-frac49.0%
neg-mul-149.0%
distribute-rgt-neg-in49.0%
times-frac49.0%
metadata-eval49.0%
neg-mul-149.0%
Simplified49.1%
Taylor expanded in b around inf 93.1%
fma-def93.1%
associate-/l*93.1%
unpow293.1%
+-commutative93.1%
fma-def93.1%
associate-/l*93.1%
unpow293.1%
associate-*r/93.1%
Simplified93.1%
Final simplification91.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma b b (* c (* -3.0 a)))))
(if (<= b 8.0)
(* (/ (- t_0 (* b b)) (+ b (sqrt t_0))) (/ 0.3333333333333333 a))
(/
(fma
-0.5
(/ (* c a) b)
(+
(* -0.375 (* (* a a) (/ (* c c) (pow b 3.0))))
(* -0.5625 (/ (pow (* c a) 3.0) (pow b 5.0)))))
a))))
double code(double a, double b, double c) {
double t_0 = fma(b, b, (c * (-3.0 * a)));
double tmp;
if (b <= 8.0) {
tmp = ((t_0 - (b * b)) / (b + sqrt(t_0))) * (0.3333333333333333 / a);
} else {
tmp = fma(-0.5, ((c * a) / b), ((-0.375 * ((a * a) * ((c * c) / pow(b, 3.0)))) + (-0.5625 * (pow((c * a), 3.0) / pow(b, 5.0))))) / a;
}
return tmp;
}
function code(a, b, c) t_0 = fma(b, b, Float64(c * Float64(-3.0 * a))) tmp = 0.0 if (b <= 8.0) tmp = Float64(Float64(Float64(t_0 - Float64(b * b)) / Float64(b + sqrt(t_0))) * Float64(0.3333333333333333 / a)); else tmp = Float64(fma(-0.5, Float64(Float64(c * a) / b), Float64(Float64(-0.375 * Float64(Float64(a * a) * Float64(Float64(c * c) / (b ^ 3.0)))) + Float64(-0.5625 * Float64((Float64(c * a) ^ 3.0) / (b ^ 5.0))))) / a); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(b * b + N[(c * N[(-3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 8.0], N[(N[(N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision] + N[(N[(-0.375 * N[(N[(a * a), $MachinePrecision] * N[(N[(c * c), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5625 * N[(N[Power[N[(c * a), $MachinePrecision], 3.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(b, b, c \cdot \left(-3 \cdot a\right)\right)\\
\mathbf{if}\;b \leq 8:\\
\;\;\;\;\frac{t_0 - b \cdot b}{b + \sqrt{t_0}} \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.5, \frac{c \cdot a}{b}, -0.375 \cdot \left(\left(a \cdot a\right) \cdot \frac{c \cdot c}{{b}^{3}}\right) + -0.5625 \cdot \frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}\right)}{a}\\
\end{array}
\end{array}
if b < 8Initial program 83.8%
neg-sub083.8%
associate-+l-83.8%
sub0-neg83.8%
neg-mul-183.8%
associate-*r/83.8%
*-commutative83.8%
metadata-eval83.8%
metadata-eval83.8%
times-frac83.8%
*-commutative83.8%
times-frac83.7%
Simplified84.0%
add-cube-cbrt83.8%
pow383.9%
Applied egg-rr83.9%
flip--83.6%
add-sqr-sqrt84.7%
unpow384.7%
add-cube-cbrt84.9%
unpow384.9%
add-cube-cbrt84.9%
Applied egg-rr84.9%
*-commutative84.9%
associate-*l*84.9%
+-commutative84.9%
*-commutative84.9%
associate-*l*84.9%
Simplified84.9%
if 8 < b Initial program 49.0%
/-rgt-identity49.0%
metadata-eval49.0%
associate-/r/49.0%
metadata-eval49.0%
metadata-eval49.0%
times-frac49.0%
*-commutative49.0%
times-frac49.0%
*-commutative49.0%
associate-/r*49.0%
associate-*l/49.0%
Simplified49.1%
Taylor expanded in b around inf 92.9%
fma-def92.9%
*-commutative92.9%
fma-def92.9%
associate-/l*92.9%
unpow292.9%
unpow292.9%
*-commutative92.9%
cube-prod92.9%
Simplified92.9%
fma-udef92.9%
associate-/r/92.9%
Applied egg-rr92.9%
Final simplification91.0%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma b b (* c (* -3.0 a)))))
(if (<= b 8.2)
(* (/ (- t_0 (* b b)) (+ b (sqrt t_0))) (/ 0.3333333333333333 a))
(fma -0.375 (/ (* c c) (/ (pow b 3.0) a)) (/ (* c -0.5) b)))))
double code(double a, double b, double c) {
double t_0 = fma(b, b, (c * (-3.0 * a)));
double tmp;
if (b <= 8.2) {
tmp = ((t_0 - (b * b)) / (b + sqrt(t_0))) * (0.3333333333333333 / a);
} else {
tmp = fma(-0.375, ((c * c) / (pow(b, 3.0) / a)), ((c * -0.5) / b));
}
return tmp;
}
function code(a, b, c) t_0 = fma(b, b, Float64(c * Float64(-3.0 * a))) tmp = 0.0 if (b <= 8.2) tmp = Float64(Float64(Float64(t_0 - Float64(b * b)) / Float64(b + sqrt(t_0))) * Float64(0.3333333333333333 / a)); else tmp = fma(-0.375, Float64(Float64(c * c) / Float64((b ^ 3.0) / a)), Float64(Float64(c * -0.5) / b)); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(b * b + N[(c * N[(-3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 8.2], N[(N[(N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(-0.375 * N[(N[(c * c), $MachinePrecision] / N[(N[Power[b, 3.0], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(b, b, c \cdot \left(-3 \cdot a\right)\right)\\
\mathbf{if}\;b \leq 8.2:\\
\;\;\;\;\frac{t_0 - b \cdot b}{b + \sqrt{t_0}} \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, \frac{c \cdot -0.5}{b}\right)\\
\end{array}
\end{array}
if b < 8.1999999999999993Initial program 83.7%
neg-sub083.7%
associate-+l-83.7%
sub0-neg83.7%
neg-mul-183.7%
associate-*r/83.7%
*-commutative83.7%
metadata-eval83.7%
metadata-eval83.7%
times-frac83.7%
*-commutative83.7%
times-frac83.7%
Simplified84.0%
add-cube-cbrt83.8%
pow383.8%
Applied egg-rr83.8%
flip--83.5%
add-sqr-sqrt84.6%
unpow384.6%
add-cube-cbrt84.8%
unpow384.8%
add-cube-cbrt84.8%
Applied egg-rr84.8%
*-commutative84.8%
associate-*l*84.8%
+-commutative84.8%
*-commutative84.8%
associate-*l*84.8%
Simplified84.8%
if 8.1999999999999993 < b Initial program 48.8%
/-rgt-identity48.8%
metadata-eval48.8%
associate-/l*48.8%
associate-*r/48.8%
*-commutative48.8%
associate-*l/48.8%
associate-*r/48.8%
metadata-eval48.8%
metadata-eval48.8%
times-frac48.8%
neg-mul-148.8%
distribute-rgt-neg-in48.8%
times-frac48.8%
metadata-eval48.8%
neg-mul-148.8%
Simplified49.0%
Taylor expanded in b around inf 88.3%
+-commutative88.3%
fma-def88.3%
associate-/l*88.3%
unpow288.3%
associate-*r/88.3%
Simplified88.3%
Final simplification87.4%
(FPCore (a b c)
:precision binary64
(if (<= b 8.2)
(*
(- (sqrt (fma b b (* a (* c -3.0)))) b)
(sqrt (/ 0.1111111111111111 (* a a))))
(fma -0.375 (/ (* c c) (/ (pow b 3.0) a)) (/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 8.2) {
tmp = (sqrt(fma(b, b, (a * (c * -3.0)))) - b) * sqrt((0.1111111111111111 / (a * a)));
} else {
tmp = fma(-0.375, ((c * c) / (pow(b, 3.0) / a)), ((c * -0.5) / b));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 8.2) tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(c * -3.0)))) - b) * sqrt(Float64(0.1111111111111111 / Float64(a * a)))); else tmp = fma(-0.375, Float64(Float64(c * c) / Float64((b ^ 3.0) / a)), Float64(Float64(c * -0.5) / b)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 8.2], N[(N[(N[Sqrt[N[(b * b + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[Sqrt[N[(0.1111111111111111 / N[(a * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.375 * N[(N[(c * c), $MachinePrecision] / N[(N[Power[b, 3.0], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.2:\\
\;\;\;\;\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b\right) \cdot \sqrt{\frac{0.1111111111111111}{a \cdot a}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, \frac{c \cdot -0.5}{b}\right)\\
\end{array}
\end{array}
if b < 8.1999999999999993Initial program 83.7%
neg-sub083.7%
associate-+l-83.7%
sub0-neg83.7%
neg-mul-183.7%
associate-*r/83.7%
*-commutative83.7%
metadata-eval83.7%
metadata-eval83.7%
times-frac83.7%
*-commutative83.7%
times-frac83.7%
Simplified84.0%
add-sqr-sqrt84.0%
sqrt-unprod84.0%
frac-times84.1%
metadata-eval84.1%
Applied egg-rr84.1%
if 8.1999999999999993 < b Initial program 48.8%
/-rgt-identity48.8%
metadata-eval48.8%
associate-/l*48.8%
associate-*r/48.8%
*-commutative48.8%
associate-*l/48.8%
associate-*r/48.8%
metadata-eval48.8%
metadata-eval48.8%
times-frac48.8%
neg-mul-148.8%
distribute-rgt-neg-in48.8%
times-frac48.8%
metadata-eval48.8%
neg-mul-148.8%
Simplified49.0%
Taylor expanded in b around inf 88.3%
+-commutative88.3%
fma-def88.3%
associate-/l*88.3%
unpow288.3%
associate-*r/88.3%
Simplified88.3%
Final simplification87.3%
(FPCore (a b c) :precision binary64 (if (<= b 8.2) (* -0.3333333333333333 (/ (- b (sqrt (fma b b (* a (* c -3.0))))) a)) (fma -0.375 (/ (* c c) (/ (pow b 3.0) a)) (/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 8.2) {
tmp = -0.3333333333333333 * ((b - sqrt(fma(b, b, (a * (c * -3.0))))) / a);
} else {
tmp = fma(-0.375, ((c * c) / (pow(b, 3.0) / a)), ((c * -0.5) / b));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 8.2) tmp = Float64(-0.3333333333333333 * Float64(Float64(b - sqrt(fma(b, b, Float64(a * Float64(c * -3.0))))) / a)); else tmp = fma(-0.375, Float64(Float64(c * c) / Float64((b ^ 3.0) / a)), Float64(Float64(c * -0.5) / b)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 8.2], N[(-0.3333333333333333 * N[(N[(b - N[Sqrt[N[(b * b + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-0.375 * N[(N[(c * c), $MachinePrecision] / N[(N[Power[b, 3.0], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.2:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, \frac{c \cdot -0.5}{b}\right)\\
\end{array}
\end{array}
if b < 8.1999999999999993Initial program 83.7%
/-rgt-identity83.7%
metadata-eval83.7%
associate-/l*83.7%
associate-*r/83.7%
*-commutative83.7%
associate-*l/83.7%
associate-*r/83.7%
metadata-eval83.7%
metadata-eval83.7%
times-frac83.7%
neg-mul-183.7%
distribute-rgt-neg-in83.7%
times-frac83.7%
metadata-eval83.7%
neg-mul-183.7%
Simplified84.1%
if 8.1999999999999993 < b Initial program 48.8%
/-rgt-identity48.8%
metadata-eval48.8%
associate-/l*48.8%
associate-*r/48.8%
*-commutative48.8%
associate-*l/48.8%
associate-*r/48.8%
metadata-eval48.8%
metadata-eval48.8%
times-frac48.8%
neg-mul-148.8%
distribute-rgt-neg-in48.8%
times-frac48.8%
metadata-eval48.8%
neg-mul-148.8%
Simplified49.0%
Taylor expanded in b around inf 88.3%
+-commutative88.3%
fma-def88.3%
associate-/l*88.3%
unpow288.3%
associate-*r/88.3%
Simplified88.3%
Final simplification87.3%
(FPCore (a b c)
:precision binary64
(if (<= b 8.2)
(* -0.3333333333333333 (/ (- b (sqrt (fma b b (* a (* c -3.0))))) a))
(*
-0.3333333333333333
(+ (* (/ (* a (* c c)) (pow b 3.0)) 1.125) (* 1.5 (/ c b))))))
double code(double a, double b, double c) {
double tmp;
if (b <= 8.2) {
tmp = -0.3333333333333333 * ((b - sqrt(fma(b, b, (a * (c * -3.0))))) / a);
} else {
tmp = -0.3333333333333333 * ((((a * (c * c)) / pow(b, 3.0)) * 1.125) + (1.5 * (c / b)));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 8.2) tmp = Float64(-0.3333333333333333 * Float64(Float64(b - sqrt(fma(b, b, Float64(a * Float64(c * -3.0))))) / a)); else tmp = Float64(-0.3333333333333333 * Float64(Float64(Float64(Float64(a * Float64(c * c)) / (b ^ 3.0)) * 1.125) + Float64(1.5 * Float64(c / b)))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 8.2], N[(-0.3333333333333333 * N[(N[(b - N[Sqrt[N[(b * b + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(N[(N[(N[(a * N[(c * c), $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * 1.125), $MachinePrecision] + N[(1.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.2:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(\frac{a \cdot \left(c \cdot c\right)}{{b}^{3}} \cdot 1.125 + 1.5 \cdot \frac{c}{b}\right)\\
\end{array}
\end{array}
if b < 8.1999999999999993Initial program 83.7%
/-rgt-identity83.7%
metadata-eval83.7%
associate-/l*83.7%
associate-*r/83.7%
*-commutative83.7%
associate-*l/83.7%
associate-*r/83.7%
metadata-eval83.7%
metadata-eval83.7%
times-frac83.7%
neg-mul-183.7%
distribute-rgt-neg-in83.7%
times-frac83.7%
metadata-eval83.7%
neg-mul-183.7%
Simplified84.1%
if 8.1999999999999993 < b Initial program 48.8%
/-rgt-identity48.8%
metadata-eval48.8%
associate-/l*48.8%
associate-*r/48.8%
*-commutative48.8%
associate-*l/48.8%
associate-*r/48.8%
metadata-eval48.8%
metadata-eval48.8%
times-frac48.8%
neg-mul-148.8%
distribute-rgt-neg-in48.8%
times-frac48.8%
metadata-eval48.8%
neg-mul-148.8%
Simplified49.0%
Taylor expanded in b around inf 88.0%
fma-def88.0%
*-commutative88.0%
unpow288.0%
Simplified88.0%
fma-udef88.0%
*-commutative88.0%
Applied egg-rr88.0%
Final simplification87.1%
(FPCore (a b c)
:precision binary64
(if (<= b 8.2)
(/ (- (sqrt (- (* b b) (* a (* c 3.0)))) b) (* a 3.0))
(*
-0.3333333333333333
(+ (* (/ (* a (* c c)) (pow b 3.0)) 1.125) (* 1.5 (/ c b))))))
double code(double a, double b, double c) {
double tmp;
if (b <= 8.2) {
tmp = (sqrt(((b * b) - (a * (c * 3.0)))) - b) / (a * 3.0);
} else {
tmp = -0.3333333333333333 * ((((a * (c * c)) / pow(b, 3.0)) * 1.125) + (1.5 * (c / b)));
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 8.2d0) then
tmp = (sqrt(((b * b) - (a * (c * 3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (-0.3333333333333333d0) * ((((a * (c * c)) / (b ** 3.0d0)) * 1.125d0) + (1.5d0 * (c / b)))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 8.2) {
tmp = (Math.sqrt(((b * b) - (a * (c * 3.0)))) - b) / (a * 3.0);
} else {
tmp = -0.3333333333333333 * ((((a * (c * c)) / Math.pow(b, 3.0)) * 1.125) + (1.5 * (c / b)));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 8.2: tmp = (math.sqrt(((b * b) - (a * (c * 3.0)))) - b) / (a * 3.0) else: tmp = -0.3333333333333333 * ((((a * (c * c)) / math.pow(b, 3.0)) * 1.125) + (1.5 * (c / b))) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 8.2) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(a * Float64(c * 3.0)))) - b) / Float64(a * 3.0)); else tmp = Float64(-0.3333333333333333 * Float64(Float64(Float64(Float64(a * Float64(c * c)) / (b ^ 3.0)) * 1.125) + Float64(1.5 * Float64(c / b)))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 8.2) tmp = (sqrt(((b * b) - (a * (c * 3.0)))) - b) / (a * 3.0); else tmp = -0.3333333333333333 * ((((a * (c * c)) / (b ^ 3.0)) * 1.125) + (1.5 * (c / b))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 8.2], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(a * N[(c * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(N[(N[(N[(a * N[(c * c), $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * 1.125), $MachinePrecision] + N[(1.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.2:\\
\;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(\frac{a \cdot \left(c \cdot c\right)}{{b}^{3}} \cdot 1.125 + 1.5 \cdot \frac{c}{b}\right)\\
\end{array}
\end{array}
if b < 8.1999999999999993Initial program 83.7%
neg-sub083.7%
associate-+l-83.7%
sub0-neg83.7%
neg-mul-183.7%
associate-*r/83.7%
metadata-eval83.7%
metadata-eval83.7%
times-frac83.7%
*-commutative83.7%
times-frac83.7%
associate-*l/83.7%
Simplified83.7%
Taylor expanded in a around 0 83.7%
associate-*r*83.8%
Simplified83.8%
if 8.1999999999999993 < b Initial program 48.8%
/-rgt-identity48.8%
metadata-eval48.8%
associate-/l*48.8%
associate-*r/48.8%
*-commutative48.8%
associate-*l/48.8%
associate-*r/48.8%
metadata-eval48.8%
metadata-eval48.8%
times-frac48.8%
neg-mul-148.8%
distribute-rgt-neg-in48.8%
times-frac48.8%
metadata-eval48.8%
neg-mul-148.8%
Simplified49.0%
Taylor expanded in b around inf 88.0%
fma-def88.0%
*-commutative88.0%
unpow288.0%
Simplified88.0%
fma-udef88.0%
*-commutative88.0%
Applied egg-rr88.0%
Final simplification87.0%
(FPCore (a b c)
:precision binary64
(if (<= b 8.2)
(/ (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) (* a 3.0))
(*
-0.3333333333333333
(* c (+ (/ 1.5 b) (* 1.125 (* c (* a (pow b -3.0)))))))))
double code(double a, double b, double c) {
double tmp;
if (b <= 8.2) {
tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
} else {
tmp = -0.3333333333333333 * (c * ((1.5 / b) + (1.125 * (c * (a * pow(b, -3.0))))));
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 8.2d0) then
tmp = (sqrt(((b * b) - (3.0d0 * (c * a)))) - b) / (a * 3.0d0)
else
tmp = (-0.3333333333333333d0) * (c * ((1.5d0 / b) + (1.125d0 * (c * (a * (b ** (-3.0d0)))))))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 8.2) {
tmp = (Math.sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
} else {
tmp = -0.3333333333333333 * (c * ((1.5 / b) + (1.125 * (c * (a * Math.pow(b, -3.0))))));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 8.2: tmp = (math.sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0) else: tmp = -0.3333333333333333 * (c * ((1.5 / b) + (1.125 * (c * (a * math.pow(b, -3.0)))))) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 8.2) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(c * a)))) - b) / Float64(a * 3.0)); else tmp = Float64(-0.3333333333333333 * Float64(c * Float64(Float64(1.5 / b) + Float64(1.125 * Float64(c * Float64(a * (b ^ -3.0))))))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 8.2) tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0); else tmp = -0.3333333333333333 * (c * ((1.5 / b) + (1.125 * (c * (a * (b ^ -3.0)))))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 8.2], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(c * N[(N[(1.5 / b), $MachinePrecision] + N[(1.125 * N[(c * N[(a * N[Power[b, -3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.2:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(c \cdot \left(\frac{1.5}{b} + 1.125 \cdot \left(c \cdot \left(a \cdot {b}^{-3}\right)\right)\right)\right)\\
\end{array}
\end{array}
if b < 8.1999999999999993Initial program 83.7%
neg-sub083.7%
associate-+l-83.7%
sub0-neg83.7%
neg-mul-183.7%
associate-*r/83.7%
metadata-eval83.7%
metadata-eval83.7%
times-frac83.7%
*-commutative83.7%
times-frac83.7%
associate-*l/83.7%
Simplified83.7%
if 8.1999999999999993 < b Initial program 48.8%
/-rgt-identity48.8%
metadata-eval48.8%
associate-/l*48.8%
associate-*r/48.8%
*-commutative48.8%
associate-*l/48.8%
associate-*r/48.8%
metadata-eval48.8%
metadata-eval48.8%
times-frac48.8%
neg-mul-148.8%
distribute-rgt-neg-in48.8%
times-frac48.8%
metadata-eval48.8%
neg-mul-148.8%
Simplified49.0%
Taylor expanded in b around inf 88.0%
fma-def88.0%
*-commutative88.0%
unpow288.0%
Simplified88.0%
add-exp-log86.4%
*-commutative86.4%
Applied egg-rr86.4%
add-exp-log88.0%
fma-udef88.0%
div-inv88.0%
associate-*l*88.0%
pow-flip88.0%
metadata-eval88.0%
Applied egg-rr88.0%
+-commutative88.0%
*-commutative88.0%
metadata-eval88.0%
times-frac88.0%
associate-*r/88.0%
*-commutative88.0%
associate-*l*88.0%
associate-*l*88.0%
distribute-lft-out88.0%
*-commutative88.0%
associate-/r*88.0%
metadata-eval88.0%
associate-*l*88.0%
Simplified88.0%
Final simplification86.9%
(FPCore (a b c)
:precision binary64
(if (<= b 8.2)
(/ (- (sqrt (- (* b b) (* a (* c 3.0)))) b) (* a 3.0))
(*
-0.3333333333333333
(* c (+ (/ 1.5 b) (* 1.125 (* c (* a (pow b -3.0)))))))))
double code(double a, double b, double c) {
double tmp;
if (b <= 8.2) {
tmp = (sqrt(((b * b) - (a * (c * 3.0)))) - b) / (a * 3.0);
} else {
tmp = -0.3333333333333333 * (c * ((1.5 / b) + (1.125 * (c * (a * pow(b, -3.0))))));
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 8.2d0) then
tmp = (sqrt(((b * b) - (a * (c * 3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (-0.3333333333333333d0) * (c * ((1.5d0 / b) + (1.125d0 * (c * (a * (b ** (-3.0d0)))))))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 8.2) {
tmp = (Math.sqrt(((b * b) - (a * (c * 3.0)))) - b) / (a * 3.0);
} else {
tmp = -0.3333333333333333 * (c * ((1.5 / b) + (1.125 * (c * (a * Math.pow(b, -3.0))))));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 8.2: tmp = (math.sqrt(((b * b) - (a * (c * 3.0)))) - b) / (a * 3.0) else: tmp = -0.3333333333333333 * (c * ((1.5 / b) + (1.125 * (c * (a * math.pow(b, -3.0)))))) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 8.2) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(a * Float64(c * 3.0)))) - b) / Float64(a * 3.0)); else tmp = Float64(-0.3333333333333333 * Float64(c * Float64(Float64(1.5 / b) + Float64(1.125 * Float64(c * Float64(a * (b ^ -3.0))))))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 8.2) tmp = (sqrt(((b * b) - (a * (c * 3.0)))) - b) / (a * 3.0); else tmp = -0.3333333333333333 * (c * ((1.5 / b) + (1.125 * (c * (a * (b ^ -3.0)))))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 8.2], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(a * N[(c * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(c * N[(N[(1.5 / b), $MachinePrecision] + N[(1.125 * N[(c * N[(a * N[Power[b, -3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.2:\\
\;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(c \cdot \left(\frac{1.5}{b} + 1.125 \cdot \left(c \cdot \left(a \cdot {b}^{-3}\right)\right)\right)\right)\\
\end{array}
\end{array}
if b < 8.1999999999999993Initial program 83.7%
neg-sub083.7%
associate-+l-83.7%
sub0-neg83.7%
neg-mul-183.7%
associate-*r/83.7%
metadata-eval83.7%
metadata-eval83.7%
times-frac83.7%
*-commutative83.7%
times-frac83.7%
associate-*l/83.7%
Simplified83.7%
Taylor expanded in a around 0 83.7%
associate-*r*83.8%
Simplified83.8%
if 8.1999999999999993 < b Initial program 48.8%
/-rgt-identity48.8%
metadata-eval48.8%
associate-/l*48.8%
associate-*r/48.8%
*-commutative48.8%
associate-*l/48.8%
associate-*r/48.8%
metadata-eval48.8%
metadata-eval48.8%
times-frac48.8%
neg-mul-148.8%
distribute-rgt-neg-in48.8%
times-frac48.8%
metadata-eval48.8%
neg-mul-148.8%
Simplified49.0%
Taylor expanded in b around inf 88.0%
fma-def88.0%
*-commutative88.0%
unpow288.0%
Simplified88.0%
add-exp-log86.4%
*-commutative86.4%
Applied egg-rr86.4%
add-exp-log88.0%
fma-udef88.0%
div-inv88.0%
associate-*l*88.0%
pow-flip88.0%
metadata-eval88.0%
Applied egg-rr88.0%
+-commutative88.0%
*-commutative88.0%
metadata-eval88.0%
times-frac88.0%
associate-*r/88.0%
*-commutative88.0%
associate-*l*88.0%
associate-*l*88.0%
distribute-lft-out88.0%
*-commutative88.0%
associate-/r*88.0%
metadata-eval88.0%
associate-*l*88.0%
Simplified88.0%
Final simplification87.0%
(FPCore (a b c) :precision binary64 (* -0.3333333333333333 (* c (+ (/ 1.5 b) (* 1.125 (* c (* a (pow b -3.0))))))))
double code(double a, double b, double c) {
return -0.3333333333333333 * (c * ((1.5 / b) + (1.125 * (c * (a * 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.3333333333333333d0) * (c * ((1.5d0 / b) + (1.125d0 * (c * (a * (b ** (-3.0d0)))))))
end function
public static double code(double a, double b, double c) {
return -0.3333333333333333 * (c * ((1.5 / b) + (1.125 * (c * (a * Math.pow(b, -3.0))))));
}
def code(a, b, c): return -0.3333333333333333 * (c * ((1.5 / b) + (1.125 * (c * (a * math.pow(b, -3.0))))))
function code(a, b, c) return Float64(-0.3333333333333333 * Float64(c * Float64(Float64(1.5 / b) + Float64(1.125 * Float64(c * Float64(a * (b ^ -3.0))))))) end
function tmp = code(a, b, c) tmp = -0.3333333333333333 * (c * ((1.5 / b) + (1.125 * (c * (a * (b ^ -3.0)))))); end
code[a_, b_, c_] := N[(-0.3333333333333333 * N[(c * N[(N[(1.5 / b), $MachinePrecision] + N[(1.125 * N[(c * N[(a * N[Power[b, -3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.3333333333333333 \cdot \left(c \cdot \left(\frac{1.5}{b} + 1.125 \cdot \left(c \cdot \left(a \cdot {b}^{-3}\right)\right)\right)\right)
\end{array}
Initial program 57.2%
/-rgt-identity57.2%
metadata-eval57.2%
associate-/l*57.2%
associate-*r/57.1%
*-commutative57.1%
associate-*l/57.2%
associate-*r/57.2%
metadata-eval57.2%
metadata-eval57.2%
times-frac57.2%
neg-mul-157.2%
distribute-rgt-neg-in57.2%
times-frac57.1%
metadata-eval57.1%
neg-mul-157.1%
Simplified57.3%
Taylor expanded in b around inf 80.2%
fma-def80.2%
*-commutative80.2%
unpow280.2%
Simplified80.2%
add-exp-log78.9%
*-commutative78.9%
Applied egg-rr78.9%
add-exp-log80.2%
fma-udef80.2%
div-inv80.2%
associate-*l*80.2%
pow-flip80.2%
metadata-eval80.2%
Applied egg-rr80.2%
+-commutative80.2%
*-commutative80.2%
metadata-eval80.2%
times-frac80.2%
associate-*r/80.2%
*-commutative80.2%
associate-*l*80.2%
associate-*l*80.2%
distribute-lft-out80.2%
*-commutative80.2%
associate-/r*80.1%
metadata-eval80.1%
associate-*l*80.1%
Simplified80.1%
Final simplification80.1%
(FPCore (a b c) :precision binary64 (/ -0.5 (/ b c)))
double code(double a, double b, double c) {
return -0.5 / (b / c);
}
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) / (b / c)
end function
public static double code(double a, double b, double c) {
return -0.5 / (b / c);
}
def code(a, b, c): return -0.5 / (b / c)
function code(a, b, c) return Float64(-0.5 / Float64(b / c)) end
function tmp = code(a, b, c) tmp = -0.5 / (b / c); end
code[a_, b_, c_] := N[(-0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.5}{\frac{b}{c}}
\end{array}
Initial program 57.2%
/-rgt-identity57.2%
metadata-eval57.2%
associate-/l*57.2%
associate-*r/57.1%
*-commutative57.1%
associate-*l/57.2%
associate-*r/57.2%
metadata-eval57.2%
metadata-eval57.2%
times-frac57.2%
neg-mul-157.2%
distribute-rgt-neg-in57.2%
times-frac57.1%
metadata-eval57.1%
neg-mul-157.1%
Simplified57.3%
Taylor expanded in b around inf 80.2%
fma-def80.2%
*-commutative80.2%
unpow280.2%
Simplified80.2%
Taylor expanded in a around 0 62.8%
associate-*r/62.7%
associate-/l*62.7%
associate-/r/62.7%
Simplified62.7%
Taylor expanded in b around 0 62.8%
associate-*r/62.7%
*-commutative62.7%
associate-/l*62.8%
Simplified62.8%
Taylor expanded in c around 0 62.8%
associate-*r/62.8%
associate-/l*62.7%
Simplified62.7%
Final simplification62.7%
(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 57.2%
/-rgt-identity57.2%
metadata-eval57.2%
associate-/l*57.2%
associate-*r/57.1%
*-commutative57.1%
associate-*l/57.2%
associate-*r/57.2%
metadata-eval57.2%
metadata-eval57.2%
times-frac57.2%
neg-mul-157.2%
distribute-rgt-neg-in57.2%
times-frac57.1%
metadata-eval57.1%
neg-mul-157.1%
Simplified57.3%
Taylor expanded in b around inf 62.8%
associate-*r/62.8%
Simplified62.8%
Final simplification62.8%
herbie shell --seed 2023200
(FPCore (a b c)
:name "Cubic critical, narrow range"
:precision binary64
:pre (and (and (and (< 1.0536712127723509e-8 a) (< a 94906265.62425156)) (and (< 1.0536712127723509e-8 b) (< b 94906265.62425156))) (and (< 1.0536712127723509e-8 c) (< c 94906265.62425156)))
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))