
(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 8 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
(if (<= b -300000000000.0)
(fma 0.5 (/ c b) (* b (/ -0.6666666666666666 a)))
(if (<= b 9.5e-70)
(* 0.3333333333333333 (/ (- (hypot b (sqrt (* a (* c -3.0)))) b) a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -300000000000.0) {
tmp = fma(0.5, (c / b), (b * (-0.6666666666666666 / a)));
} else if (b <= 9.5e-70) {
tmp = 0.3333333333333333 * ((hypot(b, sqrt((a * (c * -3.0)))) - b) / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -300000000000.0) tmp = fma(0.5, Float64(c / b), Float64(b * Float64(-0.6666666666666666 / a))); elseif (b <= 9.5e-70) tmp = Float64(0.3333333333333333 * Float64(Float64(hypot(b, sqrt(Float64(a * Float64(c * -3.0)))) - b) / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -300000000000.0], N[(0.5 * N[(c / b), $MachinePrecision] + N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.5e-70], N[(0.3333333333333333 * N[(N[(N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -300000000000:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, b \cdot \frac{-0.6666666666666666}{a}\right)\\
\mathbf{elif}\;b \leq 9.5 \cdot 10^{-70}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) - b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -3e11Initial program 63.2%
sqr-neg63.2%
sqr-neg63.2%
associate-*l*63.1%
Simplified63.1%
Taylor expanded in b around -inf 96.6%
+-commutative96.6%
fma-def96.6%
*-commutative96.6%
associate-*l/96.6%
Simplified96.6%
*-un-lft-identity96.6%
times-frac96.6%
Applied egg-rr96.6%
if -3e11 < b < 9.4999999999999994e-70Initial program 76.3%
sqr-neg76.3%
sqr-neg76.3%
associate-*l*76.2%
Simplified76.2%
associate-*r*76.3%
*-commutative76.3%
*-commutative76.3%
metadata-eval76.3%
div-inv76.2%
clear-num76.1%
un-div-inv76.1%
Applied egg-rr76.1%
associate-/r/76.2%
Simplified76.2%
expm1-log1p-u53.3%
expm1-udef20.6%
neg-mul-120.6%
fma-def20.6%
div-inv20.6%
metadata-eval20.6%
*-commutative20.6%
Applied egg-rr20.6%
expm1-def53.3%
expm1-log1p76.1%
*-lft-identity76.1%
*-commutative76.1%
times-frac76.2%
metadata-eval76.2%
Simplified78.3%
if 9.4999999999999994e-70 < b Initial program 14.2%
sqr-neg14.2%
sqr-neg14.2%
associate-*l*15.1%
Simplified15.1%
Taylor expanded in b around inf 86.6%
Final simplification86.6%
(FPCore (a b c)
:precision binary64
(if (<= b -2e+153)
(fma 0.5 (/ c b) (* b (/ -0.6666666666666666 a)))
(if (<= b 1.2e-69)
(/ (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e+153) {
tmp = fma(0.5, (c / b), (b * (-0.6666666666666666 / a)));
} else if (b <= 1.2e-69) {
tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2e+153) tmp = fma(0.5, Float64(c / b), Float64(b * Float64(-0.6666666666666666 / a))); elseif (b <= 1.2e-69) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(c * a)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2e+153], N[(0.5 * N[(c / b), $MachinePrecision] + N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.2e-69], 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[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{+153}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, b \cdot \frac{-0.6666666666666666}{a}\right)\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{-69}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -2e153Initial program 38.1%
sqr-neg38.1%
sqr-neg38.1%
associate-*l*38.1%
Simplified38.1%
Taylor expanded in b around -inf 97.5%
+-commutative97.5%
fma-def97.5%
*-commutative97.5%
associate-*l/97.4%
Simplified97.4%
*-un-lft-identity97.4%
times-frac97.5%
Applied egg-rr97.5%
if -2e153 < b < 1.2000000000000001e-69Initial program 82.3%
sqr-neg82.3%
sqr-neg82.3%
associate-*l*82.2%
Simplified82.2%
if 1.2000000000000001e-69 < b Initial program 14.2%
sqr-neg14.2%
sqr-neg14.2%
associate-*l*15.1%
Simplified15.1%
Taylor expanded in b around inf 86.6%
Final simplification86.4%
(FPCore (a b c)
:precision binary64
(if (<= b -2.75e+153)
(fma 0.5 (/ c b) (* b (/ -0.6666666666666666 a)))
(if (<= b 9e-70)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.75e+153) {
tmp = fma(0.5, (c / b), (b * (-0.6666666666666666 / a)));
} else if (b <= 9e-70) {
tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.75e+153) tmp = fma(0.5, Float64(c / b), Float64(b * Float64(-0.6666666666666666 / a))); elseif (b <= 9e-70) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.75e+153], N[(0.5 * N[(c / b), $MachinePrecision] + N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9e-70], 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], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.75 \cdot 10^{+153}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, b \cdot \frac{-0.6666666666666666}{a}\right)\\
\mathbf{elif}\;b \leq 9 \cdot 10^{-70}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -2.7500000000000001e153Initial program 38.1%
sqr-neg38.1%
sqr-neg38.1%
associate-*l*38.1%
Simplified38.1%
Taylor expanded in b around -inf 97.5%
+-commutative97.5%
fma-def97.5%
*-commutative97.5%
associate-*l/97.4%
Simplified97.4%
*-un-lft-identity97.4%
times-frac97.5%
Applied egg-rr97.5%
if -2.7500000000000001e153 < b < 9.00000000000000044e-70Initial program 82.3%
if 9.00000000000000044e-70 < b Initial program 14.2%
sqr-neg14.2%
sqr-neg14.2%
associate-*l*15.1%
Simplified15.1%
Taylor expanded in b around inf 86.6%
Final simplification86.5%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (+ (* 0.5 (/ c b)) (* -0.6666666666666666 (/ b a))) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else {
tmp = (c / b) * -0.5;
}
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 <= (-5d-310)) then
tmp = (0.5d0 * (c / b)) + ((-0.6666666666666666d0) * (b / a))
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(0.5 * Float64(c / b)) + Float64(-0.6666666666666666 * Float64(b / a))); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 69.4%
sqr-neg69.4%
sqr-neg69.4%
associate-*l*69.4%
Simplified69.4%
Taylor expanded in b around -inf 70.6%
if -4.999999999999985e-310 < b Initial program 29.2%
sqr-neg29.2%
sqr-neg29.2%
associate-*l*29.8%
Simplified29.8%
Taylor expanded in b around inf 69.1%
Final simplification69.7%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b))) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else {
tmp = (c / b) * -0.5;
}
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 <= (-5d-310)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 69.4%
sqr-neg69.4%
sqr-neg69.4%
associate-*l*69.4%
Simplified69.4%
Taylor expanded in b around -inf 70.6%
associate-*r/70.6%
*-commutative70.6%
Applied egg-rr70.6%
if -4.999999999999985e-310 < b Initial program 29.2%
sqr-neg29.2%
sqr-neg29.2%
associate-*l*29.8%
Simplified29.8%
Taylor expanded in b around inf 69.1%
Final simplification69.8%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (* -0.6666666666666666 (/ b a)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (c / b) * -0.5;
}
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 <= (-5d-310)) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = -0.6666666666666666 * (b / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = -0.6666666666666666 * (b / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 69.4%
sqr-neg69.4%
sqr-neg69.4%
associate-*l*69.4%
Simplified69.4%
Taylor expanded in b around -inf 70.5%
*-commutative70.5%
Simplified70.5%
if -4.999999999999985e-310 < b Initial program 29.2%
sqr-neg29.2%
sqr-neg29.2%
associate-*l*29.8%
Simplified29.8%
Taylor expanded in b around inf 69.1%
Final simplification69.7%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (/ -0.6666666666666666 (/ a b)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = (c / b) * -0.5;
}
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 <= (-5d-310)) then
tmp = (-0.6666666666666666d0) / (a / b)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = -0.6666666666666666 / (a / b) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(-0.6666666666666666 / Float64(a / b)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = -0.6666666666666666 / (a / b); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 69.4%
sqr-neg69.4%
sqr-neg69.4%
associate-*l*69.4%
Simplified69.4%
associate-*r*69.4%
*-commutative69.4%
*-commutative69.4%
metadata-eval69.4%
div-inv69.4%
clear-num69.4%
un-div-inv69.4%
Applied egg-rr69.4%
associate-/r/69.4%
Simplified69.4%
Taylor expanded in b around -inf 70.5%
associate-*r/70.6%
associate-/l*70.6%
Simplified70.6%
if -4.999999999999985e-310 < b Initial program 29.2%
sqr-neg29.2%
sqr-neg29.2%
associate-*l*29.8%
Simplified29.8%
Taylor expanded in b around inf 69.1%
Final simplification69.7%
(FPCore (a b c) :precision binary64 (* (/ c b) -0.5))
double code(double a, double b, double c) {
return (c / b) * -0.5;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (c / b) * (-0.5d0)
end function
public static double code(double a, double b, double c) {
return (c / b) * -0.5;
}
def code(a, b, c): return (c / b) * -0.5
function code(a, b, c) return Float64(Float64(c / b) * -0.5) end
function tmp = code(a, b, c) tmp = (c / b) * -0.5; end
code[a_, b_, c_] := N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{b} \cdot -0.5
\end{array}
Initial program 47.3%
sqr-neg47.3%
sqr-neg47.3%
associate-*l*47.6%
Simplified47.6%
Taylor expanded in b around inf 39.1%
Final simplification39.1%
herbie shell --seed 2023275
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))