
(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 6 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 (/ (/ (* c (* a (- -3.0))) (- (- b) (sqrt (fma c (* a -3.0) (* b b))))) (* a 3.0)))
double code(double a, double b, double c) {
return ((c * (a * -(-3.0))) / (-b - sqrt(fma(c, (a * -3.0), (b * b))))) / (a * 3.0);
}
function code(a, b, c) return Float64(Float64(Float64(c * Float64(a * Float64(-(-3.0)))) / Float64(Float64(-b) - sqrt(fma(c, Float64(a * -3.0), Float64(b * b))))) / Float64(a * 3.0)) end
code[a_, b_, c_] := N[(N[(N[(c * N[(a * (--3.0)), $MachinePrecision]), $MachinePrecision] / N[((-b) - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{c \cdot \left(a \cdot \left(--3\right)\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}}}{a \cdot 3}
\end{array}
Initial program 19.2%
expm1-log1p-u19.4%
*-commutative19.4%
*-commutative19.4%
Applied egg-rr19.4%
flip-+19.4%
add-sqr-sqrt19.7%
expm1-log1p-u19.8%
*-commutative19.8%
expm1-log1p-u19.9%
*-commutative19.9%
Applied egg-rr19.9%
sqr-neg19.9%
sub-neg19.9%
associate--r+99.4%
+-inverses99.4%
neg-sub099.4%
distribute-rgt-neg-in99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
metadata-eval99.4%
sub-neg99.4%
+-commutative99.4%
distribute-rgt-neg-in99.4%
fma-def99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
metadata-eval99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (- (* b b) (* c (* a 3.0)))) (t_1 (sqrt t_0)))
(if (<= (/ (- t_1 b) (* a 3.0)) -50.0)
(/ (/ (- (* b b) t_0) (- (- b) t_1)) (* a 3.0))
(+ (* -0.375 (* a (/ (* c c) (pow b 3.0)))) (* -0.5 (/ c b))))))
double code(double a, double b, double c) {
double t_0 = (b * b) - (c * (a * 3.0));
double t_1 = sqrt(t_0);
double tmp;
if (((t_1 - b) / (a * 3.0)) <= -50.0) {
tmp = (((b * b) - t_0) / (-b - t_1)) / (a * 3.0);
} else {
tmp = (-0.375 * (a * ((c * c) / pow(b, 3.0)))) + (-0.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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (c * (a * 3.0d0))
t_1 = sqrt(t_0)
if (((t_1 - b) / (a * 3.0d0)) <= (-50.0d0)) then
tmp = (((b * b) - t_0) / (-b - t_1)) / (a * 3.0d0)
else
tmp = ((-0.375d0) * (a * ((c * c) / (b ** 3.0d0)))) + ((-0.5d0) * (c / b))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (b * b) - (c * (a * 3.0));
double t_1 = Math.sqrt(t_0);
double tmp;
if (((t_1 - b) / (a * 3.0)) <= -50.0) {
tmp = (((b * b) - t_0) / (-b - t_1)) / (a * 3.0);
} else {
tmp = (-0.375 * (a * ((c * c) / Math.pow(b, 3.0)))) + (-0.5 * (c / b));
}
return tmp;
}
def code(a, b, c): t_0 = (b * b) - (c * (a * 3.0)) t_1 = math.sqrt(t_0) tmp = 0 if ((t_1 - b) / (a * 3.0)) <= -50.0: tmp = (((b * b) - t_0) / (-b - t_1)) / (a * 3.0) else: tmp = (-0.375 * (a * ((c * c) / math.pow(b, 3.0)))) + (-0.5 * (c / b)) return tmp
function code(a, b, c) t_0 = Float64(Float64(b * b) - Float64(c * Float64(a * 3.0))) t_1 = sqrt(t_0) tmp = 0.0 if (Float64(Float64(t_1 - b) / Float64(a * 3.0)) <= -50.0) tmp = Float64(Float64(Float64(Float64(b * b) - t_0) / Float64(Float64(-b) - t_1)) / Float64(a * 3.0)); else tmp = Float64(Float64(-0.375 * Float64(a * Float64(Float64(c * c) / (b ^ 3.0)))) + Float64(-0.5 * Float64(c / b))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (b * b) - (c * (a * 3.0)); t_1 = sqrt(t_0); tmp = 0.0; if (((t_1 - b) / (a * 3.0)) <= -50.0) tmp = (((b * b) - t_0) / (-b - t_1)) / (a * 3.0); else tmp = (-0.375 * (a * ((c * c) / (b ^ 3.0)))) + (-0.5 * (c / b)); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], -50.0], N[(N[(N[(N[(b * b), $MachinePrecision] - t$95$0), $MachinePrecision] / N[((-b) - t$95$1), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(-0.375 * N[(a * N[(N[(c * c), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot b - c \cdot \left(a \cdot 3\right)\\
t_1 := \sqrt{t_0}\\
\mathbf{if}\;\frac{t_1 - b}{a \cdot 3} \leq -50:\\
\;\;\;\;\frac{\frac{b \cdot b - t_0}{\left(-b\right) - t_1}}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right) + -0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)) < -50Initial program 79.3%
expm1-log1p-u74.5%
*-commutative74.5%
*-commutative74.5%
Applied egg-rr74.5%
flip-+74.5%
add-sqr-sqrt74.9%
expm1-log1p-u80.9%
*-commutative80.9%
expm1-log1p-u81.0%
*-commutative81.0%
Applied egg-rr81.0%
if -50 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)) Initial program 13.3%
/-rgt-identity13.3%
metadata-eval13.3%
associate-/l*13.3%
associate-*r/13.3%
*-commutative13.3%
associate-*l/13.3%
associate-*r/13.3%
metadata-eval13.3%
metadata-eval13.3%
times-frac13.3%
neg-mul-113.3%
distribute-rgt-neg-in13.3%
times-frac13.3%
metadata-eval13.3%
neg-mul-113.3%
Simplified13.3%
Taylor expanded in b around inf 96.8%
+-commutative96.8%
fma-def96.8%
associate-/l*96.8%
unpow296.8%
Simplified96.8%
fma-udef96.8%
associate-/r/96.8%
Applied egg-rr96.8%
Final simplification95.4%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (- (sqrt (- (* b b) (* c (* a 3.0)))) b)))
(if (<= (/ t_0 (* a 3.0)) -50.0)
(* t_0 (/ 1.0 (* a 3.0)))
(+ (* -0.375 (* a (/ (* c c) (pow b 3.0)))) (* -0.5 (/ c b))))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - (c * (a * 3.0)))) - b;
double tmp;
if ((t_0 / (a * 3.0)) <= -50.0) {
tmp = t_0 * (1.0 / (a * 3.0));
} else {
tmp = (-0.375 * (a * ((c * c) / pow(b, 3.0)))) + (-0.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) :: t_0
real(8) :: tmp
t_0 = sqrt(((b * b) - (c * (a * 3.0d0)))) - b
if ((t_0 / (a * 3.0d0)) <= (-50.0d0)) then
tmp = t_0 * (1.0d0 / (a * 3.0d0))
else
tmp = ((-0.375d0) * (a * ((c * c) / (b ** 3.0d0)))) + ((-0.5d0) * (c / b))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) - (c * (a * 3.0)))) - b;
double tmp;
if ((t_0 / (a * 3.0)) <= -50.0) {
tmp = t_0 * (1.0 / (a * 3.0));
} else {
tmp = (-0.375 * (a * ((c * c) / Math.pow(b, 3.0)))) + (-0.5 * (c / b));
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - (c * (a * 3.0)))) - b tmp = 0 if (t_0 / (a * 3.0)) <= -50.0: tmp = t_0 * (1.0 / (a * 3.0)) else: tmp = (-0.375 * (a * ((c * c) / math.pow(b, 3.0)))) + (-0.5 * (c / b)) return tmp
function code(a, b, c) t_0 = Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) tmp = 0.0 if (Float64(t_0 / Float64(a * 3.0)) <= -50.0) tmp = Float64(t_0 * Float64(1.0 / Float64(a * 3.0))); else tmp = Float64(Float64(-0.375 * Float64(a * Float64(Float64(c * c) / (b ^ 3.0)))) + Float64(-0.5 * Float64(c / b))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = sqrt(((b * b) - (c * (a * 3.0)))) - b; tmp = 0.0; if ((t_0 / (a * 3.0)) <= -50.0) tmp = t_0 * (1.0 / (a * 3.0)); else tmp = (-0.375 * (a * ((c * c) / (b ^ 3.0)))) + (-0.5 * (c / b)); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], -50.0], N[(t$95$0 * N[(1.0 / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.375 * N[(a * N[(N[(c * c), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b\\
\mathbf{if}\;\frac{t_0}{a \cdot 3} \leq -50:\\
\;\;\;\;t_0 \cdot \frac{1}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right) + -0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)) < -50Initial program 79.3%
expm1-log1p-u74.5%
*-commutative74.5%
*-commutative74.5%
Applied egg-rr74.5%
div-inv74.6%
expm1-log1p-u79.3%
*-commutative79.3%
Applied egg-rr79.3%
if -50 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)) Initial program 13.3%
/-rgt-identity13.3%
metadata-eval13.3%
associate-/l*13.3%
associate-*r/13.3%
*-commutative13.3%
associate-*l/13.3%
associate-*r/13.3%
metadata-eval13.3%
metadata-eval13.3%
times-frac13.3%
neg-mul-113.3%
distribute-rgt-neg-in13.3%
times-frac13.3%
metadata-eval13.3%
neg-mul-113.3%
Simplified13.3%
Taylor expanded in b around inf 96.8%
+-commutative96.8%
fma-def96.8%
associate-/l*96.8%
unpow296.8%
Simplified96.8%
fma-udef96.8%
associate-/r/96.8%
Applied egg-rr96.8%
Final simplification95.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))))
(if (<= t_0 -50.0)
t_0
(+ (* -0.375 (* a (/ (* c c) (pow b 3.0)))) (* -0.5 (/ c b))))))
double code(double a, double b, double c) {
double t_0 = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
double tmp;
if (t_0 <= -50.0) {
tmp = t_0;
} else {
tmp = (-0.375 * (a * ((c * c) / pow(b, 3.0)))) + (-0.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) :: t_0
real(8) :: tmp
t_0 = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
if (t_0 <= (-50.0d0)) then
tmp = t_0
else
tmp = ((-0.375d0) * (a * ((c * c) / (b ** 3.0d0)))) + ((-0.5d0) * (c / b))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
double tmp;
if (t_0 <= -50.0) {
tmp = t_0;
} else {
tmp = (-0.375 * (a * ((c * c) / Math.pow(b, 3.0)))) + (-0.5 * (c / b));
}
return tmp;
}
def code(a, b, c): t_0 = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0) tmp = 0 if t_0 <= -50.0: tmp = t_0 else: tmp = (-0.375 * (a * ((c * c) / math.pow(b, 3.0)))) + (-0.5 * (c / b)) return tmp
function code(a, b, c) t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) tmp = 0.0 if (t_0 <= -50.0) tmp = t_0; else tmp = Float64(Float64(-0.375 * Float64(a * Float64(Float64(c * c) / (b ^ 3.0)))) + Float64(-0.5 * Float64(c / b))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0); tmp = 0.0; if (t_0 <= -50.0) tmp = t_0; else tmp = (-0.375 * (a * ((c * c) / (b ^ 3.0)))) + (-0.5 * (c / b)); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -50.0], t$95$0, N[(N[(-0.375 * N[(a * N[(N[(c * c), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{if}\;t_0 \leq -50:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right) + -0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)) < -50Initial program 79.3%
if -50 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)) Initial program 13.3%
/-rgt-identity13.3%
metadata-eval13.3%
associate-/l*13.3%
associate-*r/13.3%
*-commutative13.3%
associate-*l/13.3%
associate-*r/13.3%
metadata-eval13.3%
metadata-eval13.3%
times-frac13.3%
neg-mul-113.3%
distribute-rgt-neg-in13.3%
times-frac13.3%
metadata-eval13.3%
neg-mul-113.3%
Simplified13.3%
Taylor expanded in b around inf 96.8%
+-commutative96.8%
fma-def96.8%
associate-/l*96.8%
unpow296.8%
Simplified96.8%
fma-udef96.8%
associate-/r/96.8%
Applied egg-rr96.8%
Final simplification95.2%
(FPCore (a b c) :precision binary64 (+ (* -0.375 (* a (/ (* c c) (pow b 3.0)))) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
return (-0.375 * (a * ((c * c) / pow(b, 3.0)))) + (-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.375d0) * (a * ((c * c) / (b ** 3.0d0)))) + ((-0.5d0) * (c / b))
end function
public static double code(double a, double b, double c) {
return (-0.375 * (a * ((c * c) / Math.pow(b, 3.0)))) + (-0.5 * (c / b));
}
def code(a, b, c): return (-0.375 * (a * ((c * c) / math.pow(b, 3.0)))) + (-0.5 * (c / b))
function code(a, b, c) return Float64(Float64(-0.375 * Float64(a * Float64(Float64(c * c) / (b ^ 3.0)))) + Float64(-0.5 * Float64(c / b))) end
function tmp = code(a, b, c) tmp = (-0.375 * (a * ((c * c) / (b ^ 3.0)))) + (-0.5 * (c / b)); end
code[a_, b_, c_] := N[(N[(-0.375 * N[(a * N[(N[(c * c), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right) + -0.5 \cdot \frac{c}{b}
\end{array}
Initial program 19.2%
/-rgt-identity19.2%
metadata-eval19.2%
associate-/l*19.2%
associate-*r/19.2%
*-commutative19.2%
associate-*l/19.2%
associate-*r/19.2%
metadata-eval19.2%
metadata-eval19.2%
times-frac19.2%
neg-mul-119.2%
distribute-rgt-neg-in19.2%
times-frac19.2%
metadata-eval19.2%
neg-mul-119.2%
Simplified19.2%
Taylor expanded in b around inf 93.6%
+-commutative93.6%
fma-def93.6%
associate-/l*93.6%
unpow293.6%
Simplified93.6%
fma-udef93.6%
associate-/r/93.6%
Applied egg-rr93.6%
Final simplification93.6%
(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 19.2%
/-rgt-identity19.2%
metadata-eval19.2%
associate-/l*19.2%
associate-*r/19.2%
*-commutative19.2%
associate-*l/19.2%
associate-*r/19.2%
metadata-eval19.2%
metadata-eval19.2%
times-frac19.2%
neg-mul-119.2%
distribute-rgt-neg-in19.2%
times-frac19.2%
metadata-eval19.2%
neg-mul-119.2%
Simplified19.2%
Taylor expanded in b around inf 89.3%
Final simplification89.3%
herbie shell --seed 2023257
(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)))