
(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 18 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 -7.2e+107)
(/ (fma b -2.0 (* (/ c (/ b a)) 1.5)) (* a 3.0))
(if (<= b 6e-144)
(/ (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.2e+107) {
tmp = fma(b, -2.0, ((c / (b / a)) * 1.5)) / (a * 3.0);
} else if (b <= 6e-144) {
tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -7.2e+107) tmp = Float64(fma(b, -2.0, Float64(Float64(c / Float64(b / a)) * 1.5)) / Float64(a * 3.0)); elseif (b <= 6e-144) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(c * a)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -7.2e+107], N[(N[(b * -2.0 + N[(N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6e-144], 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 * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.2 \cdot 10^{+107}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{c}{\frac{b}{a}} \cdot 1.5\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 6 \cdot 10^{-144}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -7.1999999999999995e107Initial program 44.2%
Taylor expanded in b around -inf 95.5%
+-commutative95.5%
*-commutative95.5%
fma-def95.5%
*-commutative95.5%
associate-/l*97.7%
Simplified97.7%
if -7.1999999999999995e107 < b < 5.9999999999999997e-144Initial program 86.9%
neg-sub086.9%
associate-+l-86.9%
sub0-neg86.9%
neg-mul-186.9%
associate-*r/86.9%
metadata-eval86.9%
metadata-eval86.9%
times-frac86.9%
*-commutative86.9%
times-frac87.0%
associate-*l/86.9%
Simplified86.9%
if 5.9999999999999997e-144 < b Initial program 16.4%
Taylor expanded in b around inf 80.6%
associate-*r/80.6%
Applied egg-rr80.6%
Final simplification85.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.3e+107)
(/ (fma b -2.0 (* (/ c (/ b a)) 1.5)) (* a 3.0))
(if (<= b 7.3e-144)
(* -0.3333333333333333 (/ (- b (sqrt (- (* b b) (* 3.0 (* c a))))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.3e+107) {
tmp = fma(b, -2.0, ((c / (b / a)) * 1.5)) / (a * 3.0);
} else if (b <= 7.3e-144) {
tmp = -0.3333333333333333 * ((b - sqrt(((b * b) - (3.0 * (c * a))))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.3e+107) tmp = Float64(fma(b, -2.0, Float64(Float64(c / Float64(b / a)) * 1.5)) / Float64(a * 3.0)); elseif (b <= 7.3e-144) tmp = Float64(-0.3333333333333333 * Float64(Float64(b - sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(c * a))))) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.3e+107], N[(N[(b * -2.0 + N[(N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.3e-144], N[(-0.3333333333333333 * N[(N[(b - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{+107}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{c}{\frac{b}{a}} \cdot 1.5\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 7.3 \cdot 10^{-144}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.3e107Initial program 44.2%
Taylor expanded in b around -inf 95.5%
+-commutative95.5%
*-commutative95.5%
fma-def95.5%
*-commutative95.5%
associate-/l*97.7%
Simplified97.7%
if -2.3e107 < b < 7.3000000000000003e-144Initial program 86.9%
/-rgt-identity86.9%
metadata-eval86.9%
associate-/l*86.9%
associate-*r/87.0%
*-commutative87.0%
associate-*l/86.9%
associate-*r/86.9%
metadata-eval86.9%
metadata-eval86.9%
times-frac86.9%
neg-mul-186.9%
distribute-rgt-neg-in86.9%
times-frac86.8%
metadata-eval86.8%
neg-mul-186.8%
Simplified86.9%
fma-udef86.9%
associate-*r*86.9%
*-commutative86.9%
metadata-eval86.9%
cancel-sign-sub-inv86.9%
Applied egg-rr86.9%
if 7.3000000000000003e-144 < b Initial program 16.4%
Taylor expanded in b around inf 80.6%
associate-*r/80.6%
Applied egg-rr80.6%
Final simplification85.9%
(FPCore (a b c)
:precision binary64
(if (<= b -8.5e+107)
(/ (fma b -2.0 (* (/ c (/ b a)) 1.5)) (* a 3.0))
(if (<= b 7.3e-144)
(* (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) (/ 0.3333333333333333 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8.5e+107) {
tmp = fma(b, -2.0, ((c / (b / a)) * 1.5)) / (a * 3.0);
} else if (b <= 7.3e-144) {
tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) * (0.3333333333333333 / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -8.5e+107) tmp = Float64(fma(b, -2.0, Float64(Float64(c / Float64(b / a)) * 1.5)) / Float64(a * 3.0)); elseif (b <= 7.3e-144) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(c * a)))) - b) * Float64(0.3333333333333333 / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -8.5e+107], N[(N[(b * -2.0 + N[(N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.3e-144], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.5 \cdot 10^{+107}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{c}{\frac{b}{a}} \cdot 1.5\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 7.3 \cdot 10^{-144}:\\
\;\;\;\;\left(\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -8.4999999999999999e107Initial program 44.2%
Taylor expanded in b around -inf 95.5%
+-commutative95.5%
*-commutative95.5%
fma-def95.5%
*-commutative95.5%
associate-/l*97.7%
Simplified97.7%
if -8.4999999999999999e107 < b < 7.3000000000000003e-144Initial program 86.9%
neg-sub086.9%
associate-+l-86.9%
sub0-neg86.9%
neg-mul-186.9%
associate-*r/86.9%
*-commutative86.9%
metadata-eval86.9%
metadata-eval86.9%
times-frac86.9%
*-commutative86.9%
times-frac87.0%
Simplified86.9%
fma-udef86.9%
associate-*r*86.9%
*-commutative86.9%
metadata-eval86.9%
cancel-sign-sub-inv86.9%
Applied egg-rr86.9%
if 7.3000000000000003e-144 < b Initial program 16.4%
Taylor expanded in b around inf 80.6%
associate-*r/80.6%
Applied egg-rr80.6%
Final simplification85.9%
(FPCore (a b c)
:precision binary64
(if (<= b -8e+107)
(/ (fma b -2.0 (* (/ c (/ b a)) 1.5)) (* a 3.0))
(if (<= b 2.7e-146)
(/ (- (sqrt (+ (* b b) (* a (* c -3.0)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8e+107) {
tmp = fma(b, -2.0, ((c / (b / a)) * 1.5)) / (a * 3.0);
} else if (b <= 2.7e-146) {
tmp = (sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -8e+107) tmp = Float64(fma(b, -2.0, Float64(Float64(c / Float64(b / a)) * 1.5)) / Float64(a * 3.0)); elseif (b <= 2.7e-146) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -3.0)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -8e+107], N[(N[(b * -2.0 + N[(N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.7e-146], 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[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8 \cdot 10^{+107}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{c}{\frac{b}{a}} \cdot 1.5\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 2.7 \cdot 10^{-146}:\\
\;\;\;\;\frac{\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -7.9999999999999998e107Initial program 44.2%
Taylor expanded in b around -inf 95.5%
+-commutative95.5%
*-commutative95.5%
fma-def95.5%
*-commutative95.5%
associate-/l*97.7%
Simplified97.7%
if -7.9999999999999998e107 < b < 2.69999999999999995e-146Initial program 86.9%
associate-*r*86.9%
cancel-sign-sub-inv86.9%
metadata-eval86.9%
*-commutative86.9%
associate-*r*86.9%
Applied egg-rr86.9%
if 2.69999999999999995e-146 < b Initial program 16.4%
Taylor expanded in b around inf 80.6%
associate-*r/80.6%
Applied egg-rr80.6%
Final simplification85.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.7e-155)
(fma 0.5 (/ c b) (/ -0.6666666666666666 (/ a b)))
(if (<= b 7.3e-144)
(* 0.3333333333333333 (/ (- (sqrt (* c (* a -3.0))) b) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.7e-155) {
tmp = fma(0.5, (c / b), (-0.6666666666666666 / (a / b)));
} else if (b <= 7.3e-144) {
tmp = 0.3333333333333333 * ((sqrt((c * (a * -3.0))) - b) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.7e-155) tmp = fma(0.5, Float64(c / b), Float64(-0.6666666666666666 / Float64(a / b))); elseif (b <= 7.3e-144) tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.7e-155], N[(0.5 * N[(c / b), $MachinePrecision] + N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.3e-144], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.7 \cdot 10^{-155}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{-0.6666666666666666}{\frac{a}{b}}\right)\\
\mathbf{elif}\;b \leq 7.3 \cdot 10^{-144}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.69999999999999981e-155Initial program 70.6%
neg-sub070.6%
associate-+l-70.6%
sub0-neg70.6%
neg-mul-170.6%
associate-*r/70.6%
*-commutative70.6%
metadata-eval70.6%
metadata-eval70.6%
times-frac70.6%
*-commutative70.6%
times-frac70.5%
Simplified70.5%
fma-udef70.5%
associate-*r*70.5%
*-commutative70.5%
metadata-eval70.5%
cancel-sign-sub-inv70.5%
Applied egg-rr70.5%
Taylor expanded in b around -inf 84.9%
+-commutative84.9%
fma-def84.9%
associate-*r/85.0%
associate-/l*84.9%
Simplified84.9%
if -2.69999999999999981e-155 < b < 7.3000000000000003e-144Initial program 79.7%
Taylor expanded in b around 0 79.8%
expm1-log1p-u59.5%
expm1-udef20.0%
Applied egg-rr20.0%
expm1-def59.5%
expm1-log1p79.6%
*-commutative79.6%
metadata-eval79.6%
associate-/r*79.9%
associate-*l/79.7%
times-frac79.6%
metadata-eval79.6%
fma-udef79.6%
neg-mul-179.6%
+-commutative79.6%
unsub-neg79.6%
Simplified79.6%
if 7.3000000000000003e-144 < b Initial program 16.4%
Taylor expanded in b around inf 80.6%
associate-*r/80.6%
Applied egg-rr80.6%
Final simplification81.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.7e-155)
(fma 0.5 (/ c b) (/ -0.6666666666666666 (/ a b)))
(if (<= b 7.3e-144)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.7e-155) {
tmp = fma(0.5, (c / b), (-0.6666666666666666 / (a / b)));
} else if (b <= 7.3e-144) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.7e-155) tmp = fma(0.5, Float64(c / b), Float64(-0.6666666666666666 / Float64(a / b))); elseif (b <= 7.3e-144) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.7e-155], N[(0.5 * N[(c / b), $MachinePrecision] + N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.3e-144], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.7 \cdot 10^{-155}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{-0.6666666666666666}{\frac{a}{b}}\right)\\
\mathbf{elif}\;b \leq 7.3 \cdot 10^{-144}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.69999999999999981e-155Initial program 70.6%
neg-sub070.6%
associate-+l-70.6%
sub0-neg70.6%
neg-mul-170.6%
associate-*r/70.6%
*-commutative70.6%
metadata-eval70.6%
metadata-eval70.6%
times-frac70.6%
*-commutative70.6%
times-frac70.5%
Simplified70.5%
fma-udef70.5%
associate-*r*70.5%
*-commutative70.5%
metadata-eval70.5%
cancel-sign-sub-inv70.5%
Applied egg-rr70.5%
Taylor expanded in b around -inf 84.9%
+-commutative84.9%
fma-def84.9%
associate-*r/85.0%
associate-/l*84.9%
Simplified84.9%
if -2.69999999999999981e-155 < b < 7.3000000000000003e-144Initial program 79.7%
Taylor expanded in b around 0 79.8%
*-commutative79.8%
*-commutative79.8%
*-commutative79.8%
associate-*l*79.7%
Simplified79.7%
+-commutative79.7%
*-un-lft-identity79.7%
fma-def79.7%
Applied egg-rr79.7%
fma-udef79.7%
*-lft-identity79.7%
unsub-neg79.7%
Simplified79.7%
if 7.3000000000000003e-144 < b Initial program 16.4%
Taylor expanded in b around inf 80.6%
associate-*r/80.6%
Applied egg-rr80.6%
Final simplification81.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.7e-155)
(fma 0.5 (/ c b) (/ -0.6666666666666666 (/ a b)))
(if (<= b 7.3e-144)
(/ (- (sqrt (* (* c a) -3.0)) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.7e-155) {
tmp = fma(0.5, (c / b), (-0.6666666666666666 / (a / b)));
} else if (b <= 7.3e-144) {
tmp = (sqrt(((c * a) * -3.0)) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.7e-155) tmp = fma(0.5, Float64(c / b), Float64(-0.6666666666666666 / Float64(a / b))); elseif (b <= 7.3e-144) tmp = Float64(Float64(sqrt(Float64(Float64(c * a) * -3.0)) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.7e-155], N[(0.5 * N[(c / b), $MachinePrecision] + N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.3e-144], N[(N[(N[Sqrt[N[(N[(c * a), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.7 \cdot 10^{-155}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{-0.6666666666666666}{\frac{a}{b}}\right)\\
\mathbf{elif}\;b \leq 7.3 \cdot 10^{-144}:\\
\;\;\;\;\frac{\sqrt{\left(c \cdot a\right) \cdot -3} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.69999999999999981e-155Initial program 70.6%
neg-sub070.6%
associate-+l-70.6%
sub0-neg70.6%
neg-mul-170.6%
associate-*r/70.6%
*-commutative70.6%
metadata-eval70.6%
metadata-eval70.6%
times-frac70.6%
*-commutative70.6%
times-frac70.5%
Simplified70.5%
fma-udef70.5%
associate-*r*70.5%
*-commutative70.5%
metadata-eval70.5%
cancel-sign-sub-inv70.5%
Applied egg-rr70.5%
Taylor expanded in b around -inf 84.9%
+-commutative84.9%
fma-def84.9%
associate-*r/85.0%
associate-/l*84.9%
Simplified84.9%
if -2.69999999999999981e-155 < b < 7.3000000000000003e-144Initial program 79.7%
Taylor expanded in b around 0 79.8%
if 7.3000000000000003e-144 < b Initial program 16.4%
Taylor expanded in b around inf 80.6%
associate-*r/80.6%
Applied egg-rr80.6%
Final simplification81.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.7e-155)
(/ (fma b -2.0 (* (/ c (/ b a)) 1.5)) (* a 3.0))
(if (<= b 7.3e-144)
(/ (- (sqrt (* (* c a) -3.0)) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.7e-155) {
tmp = fma(b, -2.0, ((c / (b / a)) * 1.5)) / (a * 3.0);
} else if (b <= 7.3e-144) {
tmp = (sqrt(((c * a) * -3.0)) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.7e-155) tmp = Float64(fma(b, -2.0, Float64(Float64(c / Float64(b / a)) * 1.5)) / Float64(a * 3.0)); elseif (b <= 7.3e-144) tmp = Float64(Float64(sqrt(Float64(Float64(c * a) * -3.0)) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.7e-155], N[(N[(b * -2.0 + N[(N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.3e-144], N[(N[(N[Sqrt[N[(N[(c * a), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.7 \cdot 10^{-155}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{c}{\frac{b}{a}} \cdot 1.5\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 7.3 \cdot 10^{-144}:\\
\;\;\;\;\frac{\sqrt{\left(c \cdot a\right) \cdot -3} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.69999999999999981e-155Initial program 70.6%
Taylor expanded in b around -inf 84.0%
+-commutative84.0%
*-commutative84.0%
fma-def84.0%
*-commutative84.0%
associate-/l*85.1%
Simplified85.1%
if -2.69999999999999981e-155 < b < 7.3000000000000003e-144Initial program 79.7%
Taylor expanded in b around 0 79.8%
if 7.3000000000000003e-144 < b Initial program 16.4%
Taylor expanded in b around inf 80.6%
associate-*r/80.6%
Applied egg-rr80.6%
Final simplification82.0%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (fma 0.5 (/ c b) (/ -0.6666666666666666 (/ a b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = fma(0.5, (c / b), (-0.6666666666666666 / (a / b)));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = fma(0.5, Float64(c / b), Float64(-0.6666666666666666 / Float64(a / b))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(0.5 * N[(c / b), $MachinePrecision] + N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{-0.6666666666666666}{\frac{a}{b}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 70.3%
neg-sub070.3%
associate-+l-70.3%
sub0-neg70.3%
neg-mul-170.3%
associate-*r/70.3%
*-commutative70.3%
metadata-eval70.3%
metadata-eval70.3%
times-frac70.3%
*-commutative70.3%
times-frac70.3%
Simplified70.3%
fma-udef70.3%
associate-*r*70.3%
*-commutative70.3%
metadata-eval70.3%
cancel-sign-sub-inv70.3%
Applied egg-rr70.3%
Taylor expanded in b around -inf 66.3%
+-commutative66.3%
fma-def66.3%
associate-*r/66.4%
associate-/l*66.3%
Simplified66.3%
if -5.00000000000023e-311 < b Initial program 29.9%
Taylor expanded in b around inf 67.6%
associate-*r/67.6%
Applied egg-rr67.6%
Final simplification67.0%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (+ (* (/ b a) -0.6666666666666666) (* 0.5 (/ c b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = ((b / a) * -0.6666666666666666) + (0.5 * (c / b));
} else {
tmp = (c * -0.5) / 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 <= (-5d-311)) then
tmp = ((b / a) * (-0.6666666666666666d0)) + (0.5d0 * (c / b))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = ((b / a) * -0.6666666666666666) + (0.5 * (c / b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = ((b / a) * -0.6666666666666666) + (0.5 * (c / b)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(Float64(Float64(b / a) * -0.6666666666666666) + Float64(0.5 * Float64(c / b))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-311) tmp = ((b / a) * -0.6666666666666666) + (0.5 * (c / b)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666 + 0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 70.3%
Taylor expanded in b around -inf 66.3%
if -5.00000000000023e-311 < b Initial program 29.9%
Taylor expanded in b around inf 67.6%
associate-*r/67.6%
Applied egg-rr67.6%
Final simplification67.0%
(FPCore (a b c) :precision binary64 (if (<= b 1.75e-307) (* (/ 0.3333333333333333 a) (* b -2.0)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.75e-307) {
tmp = (0.3333333333333333 / a) * (b * -2.0);
} else {
tmp = (c * -0.5) / 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 <= 1.75d-307) then
tmp = (0.3333333333333333d0 / a) * (b * (-2.0d0))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.75e-307) {
tmp = (0.3333333333333333 / a) * (b * -2.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.75e-307: tmp = (0.3333333333333333 / a) * (b * -2.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.75e-307) tmp = Float64(Float64(0.3333333333333333 / a) * Float64(b * -2.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.75e-307) tmp = (0.3333333333333333 / a) * (b * -2.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.75e-307], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(b * -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.75 \cdot 10^{-307}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(b \cdot -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.7500000000000001e-307Initial program 70.8%
neg-sub070.8%
associate-+l-70.8%
sub0-neg70.8%
neg-mul-170.8%
associate-*r/70.8%
*-commutative70.8%
metadata-eval70.8%
metadata-eval70.8%
times-frac70.8%
*-commutative70.8%
times-frac70.8%
Simplified70.8%
fma-udef70.8%
associate-*r*70.7%
*-commutative70.7%
metadata-eval70.7%
cancel-sign-sub-inv70.7%
Applied egg-rr70.7%
Taylor expanded in b around -inf 64.8%
*-commutative64.8%
Simplified64.8%
if 1.7500000000000001e-307 < b Initial program 28.8%
Taylor expanded in b around inf 68.5%
associate-*r/68.5%
Applied egg-rr68.5%
Final simplification66.8%
(FPCore (a b c) :precision binary64 (if (<= b 3.3e-307) (/ (* b -2.0) (* a 3.0)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.3e-307) {
tmp = (b * -2.0) / (a * 3.0);
} else {
tmp = (c * -0.5) / 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 <= 3.3d-307) then
tmp = (b * (-2.0d0)) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 3.3e-307) {
tmp = (b * -2.0) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3.3e-307: tmp = (b * -2.0) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3.3e-307) tmp = Float64(Float64(b * -2.0) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 3.3e-307) tmp = (b * -2.0) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3.3e-307], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.3 \cdot 10^{-307}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 3.3e-307Initial program 70.8%
Taylor expanded in b around -inf 64.8%
*-commutative64.8%
Simplified64.8%
if 3.3e-307 < b Initial program 28.8%
Taylor expanded in b around inf 68.5%
associate-*r/68.5%
Applied egg-rr68.5%
Final simplification66.8%
(FPCore (a b c) :precision binary64 (if (<= b 1.75e-307) (* (/ b a) -0.3333333333333333) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.75e-307) {
tmp = (b / a) * -0.3333333333333333;
} else {
tmp = -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) :: tmp
if (b <= 1.75d-307) then
tmp = (b / a) * (-0.3333333333333333d0)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.75e-307) {
tmp = (b / a) * -0.3333333333333333;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.75e-307: tmp = (b / a) * -0.3333333333333333 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.75e-307) tmp = Float64(Float64(b / a) * -0.3333333333333333); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.75e-307) tmp = (b / a) * -0.3333333333333333; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.75e-307], N[(N[(b / a), $MachinePrecision] * -0.3333333333333333), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.75 \cdot 10^{-307}:\\
\;\;\;\;\frac{b}{a} \cdot -0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 1.7500000000000001e-307Initial program 70.8%
Taylor expanded in b around 0 42.0%
*-commutative42.0%
*-commutative42.0%
*-commutative42.0%
associate-*l*42.0%
Simplified42.0%
Taylor expanded in b around inf 24.7%
if 1.7500000000000001e-307 < b Initial program 28.8%
Taylor expanded in b around inf 68.5%
Final simplification48.1%
(FPCore (a b c) :precision binary64 (if (<= b 1.8e-307) (* (/ b a) -0.6666666666666666) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.8e-307) {
tmp = (b / a) * -0.6666666666666666;
} else {
tmp = -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) :: tmp
if (b <= 1.8d-307) then
tmp = (b / a) * (-0.6666666666666666d0)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.8e-307) {
tmp = (b / a) * -0.6666666666666666;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.8e-307: tmp = (b / a) * -0.6666666666666666 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.8e-307) tmp = Float64(Float64(b / a) * -0.6666666666666666); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.8e-307) tmp = (b / a) * -0.6666666666666666; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.8e-307], N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.8 \cdot 10^{-307}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 1.80000000000000003e-307Initial program 70.8%
Taylor expanded in b around -inf 64.7%
*-commutative64.7%
Simplified64.7%
if 1.80000000000000003e-307 < b Initial program 28.8%
Taylor expanded in b around inf 68.5%
Final simplification66.7%
(FPCore (a b c) :precision binary64 (if (<= b 2.5e-307) (/ -0.6666666666666666 (/ a b)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.5e-307) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = -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) :: tmp
if (b <= 2.5d-307) then
tmp = (-0.6666666666666666d0) / (a / b)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2.5e-307) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.5e-307: tmp = -0.6666666666666666 / (a / b) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.5e-307) tmp = Float64(-0.6666666666666666 / Float64(a / b)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2.5e-307) tmp = -0.6666666666666666 / (a / b); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.5e-307], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.5 \cdot 10^{-307}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 2.50000000000000007e-307Initial program 70.8%
neg-sub070.8%
associate-+l-70.8%
sub0-neg70.8%
neg-mul-170.8%
associate-*r/70.8%
*-commutative70.8%
metadata-eval70.8%
metadata-eval70.8%
times-frac70.8%
*-commutative70.8%
times-frac70.8%
Simplified70.8%
fma-udef70.8%
associate-*r*70.7%
*-commutative70.7%
metadata-eval70.7%
cancel-sign-sub-inv70.7%
Applied egg-rr70.7%
Taylor expanded in b around -inf 64.7%
associate-*r/64.7%
associate-/l*64.7%
Simplified64.7%
if 2.50000000000000007e-307 < b Initial program 28.8%
Taylor expanded in b around inf 68.5%
Final simplification66.7%
(FPCore (a b c) :precision binary64 (if (<= b 1.75e-307) (/ -0.6666666666666666 (/ a b)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.75e-307) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = (c * -0.5) / 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 <= 1.75d-307) then
tmp = (-0.6666666666666666d0) / (a / b)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.75e-307) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.75e-307: tmp = -0.6666666666666666 / (a / b) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.75e-307) tmp = Float64(-0.6666666666666666 / Float64(a / b)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.75e-307) tmp = -0.6666666666666666 / (a / b); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.75e-307], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.75 \cdot 10^{-307}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.7500000000000001e-307Initial program 70.8%
neg-sub070.8%
associate-+l-70.8%
sub0-neg70.8%
neg-mul-170.8%
associate-*r/70.8%
*-commutative70.8%
metadata-eval70.8%
metadata-eval70.8%
times-frac70.8%
*-commutative70.8%
times-frac70.8%
Simplified70.8%
fma-udef70.8%
associate-*r*70.7%
*-commutative70.7%
metadata-eval70.7%
cancel-sign-sub-inv70.7%
Applied egg-rr70.7%
Taylor expanded in b around -inf 64.7%
associate-*r/64.7%
associate-/l*64.7%
Simplified64.7%
if 1.7500000000000001e-307 < b Initial program 28.8%
Taylor expanded in b around inf 68.5%
associate-*r/68.5%
Applied egg-rr68.5%
Final simplification66.7%
(FPCore (a b c) :precision binary64 (if (<= b 2e-306) (/ (* b -0.6666666666666666) a) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2e-306) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / 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 <= 2d-306) then
tmp = (b * (-0.6666666666666666d0)) / a
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2e-306) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2e-306: tmp = (b * -0.6666666666666666) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2e-306) tmp = Float64(Float64(b * -0.6666666666666666) / a); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2e-306) tmp = (b * -0.6666666666666666) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2e-306], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2 \cdot 10^{-306}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 2.00000000000000006e-306Initial program 70.8%
neg-sub070.8%
associate-+l-70.8%
sub0-neg70.8%
neg-mul-170.8%
associate-*r/70.8%
*-commutative70.8%
metadata-eval70.8%
metadata-eval70.8%
times-frac70.8%
*-commutative70.8%
times-frac70.8%
Simplified70.8%
fma-udef70.8%
associate-*r*70.7%
*-commutative70.7%
metadata-eval70.7%
cancel-sign-sub-inv70.7%
Applied egg-rr70.7%
div-inv70.7%
metadata-eval70.7%
inv-pow70.7%
unpow-prod-down70.8%
*-commutative70.8%
unpow-prod-down70.7%
inv-pow70.7%
metadata-eval70.7%
Applied egg-rr70.7%
Taylor expanded in b around -inf 64.7%
associate-*r/64.7%
*-commutative64.7%
Simplified64.7%
if 2.00000000000000006e-306 < b Initial program 28.8%
Taylor expanded in b around inf 68.5%
associate-*r/68.5%
Applied egg-rr68.5%
Final simplification66.8%
(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 48.4%
Taylor expanded in b around inf 37.8%
Final simplification37.8%
herbie shell --seed 2023201
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))