
(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 12 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 -2e+146)
(/ -1.0 (* (/ a b) 1.5))
(if (<= b -7.8e-155)
(/ (- (sqrt (+ (* b b) (* a (* c -3.0)))) b) (* a 3.0))
(if (<= b 2.6e-130)
(/ -1.0 (/ (* a 3.0) (- b (hypot b (sqrt (* c (* a -3.0)))))))
(if (<= b 6e-92)
(*
(+ b (hypot b (* (sqrt (* c -3.0)) (sqrt a))))
(/ 0.3333333333333333 a))
(if (or (<= b 2.2e-17) (not (<= b 2.2)))
(* -0.5 (/ c b))
(/ (- (sqrt (* -3.0 (* a c))) b) (* a 3.0))))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e+146) {
tmp = -1.0 / ((a / b) * 1.5);
} else if (b <= -7.8e-155) {
tmp = (sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0);
} else if (b <= 2.6e-130) {
tmp = -1.0 / ((a * 3.0) / (b - hypot(b, sqrt((c * (a * -3.0))))));
} else if (b <= 6e-92) {
tmp = (b + hypot(b, (sqrt((c * -3.0)) * sqrt(a)))) * (0.3333333333333333 / a);
} else if ((b <= 2.2e-17) || !(b <= 2.2)) {
tmp = -0.5 * (c / b);
} else {
tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 3.0);
}
return tmp;
}
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2e+146) {
tmp = -1.0 / ((a / b) * 1.5);
} else if (b <= -7.8e-155) {
tmp = (Math.sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0);
} else if (b <= 2.6e-130) {
tmp = -1.0 / ((a * 3.0) / (b - Math.hypot(b, Math.sqrt((c * (a * -3.0))))));
} else if (b <= 6e-92) {
tmp = (b + Math.hypot(b, (Math.sqrt((c * -3.0)) * Math.sqrt(a)))) * (0.3333333333333333 / a);
} else if ((b <= 2.2e-17) || !(b <= 2.2)) {
tmp = -0.5 * (c / b);
} else {
tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e+146: tmp = -1.0 / ((a / b) * 1.5) elif b <= -7.8e-155: tmp = (math.sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0) elif b <= 2.6e-130: tmp = -1.0 / ((a * 3.0) / (b - math.hypot(b, math.sqrt((c * (a * -3.0)))))) elif b <= 6e-92: tmp = (b + math.hypot(b, (math.sqrt((c * -3.0)) * math.sqrt(a)))) * (0.3333333333333333 / a) elif (b <= 2.2e-17) or not (b <= 2.2): tmp = -0.5 * (c / b) else: tmp = (math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e+146) tmp = Float64(-1.0 / Float64(Float64(a / b) * 1.5)); elseif (b <= -7.8e-155) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -3.0)))) - b) / Float64(a * 3.0)); elseif (b <= 2.6e-130) tmp = Float64(-1.0 / Float64(Float64(a * 3.0) / Float64(b - hypot(b, sqrt(Float64(c * Float64(a * -3.0))))))); elseif (b <= 6e-92) tmp = Float64(Float64(b + hypot(b, Float64(sqrt(Float64(c * -3.0)) * sqrt(a)))) * Float64(0.3333333333333333 / a)); elseif ((b <= 2.2e-17) || !(b <= 2.2)) tmp = Float64(-0.5 * Float64(c / b)); else tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(a * 3.0)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e+146) tmp = -1.0 / ((a / b) * 1.5); elseif (b <= -7.8e-155) tmp = (sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0); elseif (b <= 2.6e-130) tmp = -1.0 / ((a * 3.0) / (b - hypot(b, sqrt((c * (a * -3.0)))))); elseif (b <= 6e-92) tmp = (b + hypot(b, (sqrt((c * -3.0)) * sqrt(a)))) * (0.3333333333333333 / a); elseif ((b <= 2.2e-17) || ~((b <= 2.2))) tmp = -0.5 * (c / b); else tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 3.0); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e+146], N[(-1.0 / N[(N[(a / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -7.8e-155], 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], If[LessEqual[b, 2.6e-130], N[(-1.0 / N[(N[(a * 3.0), $MachinePrecision] / N[(b - N[Sqrt[b ^ 2 + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6e-92], N[(N[(b + N[Sqrt[b ^ 2 + N[(N[Sqrt[N[(c * -3.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[a], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 2.2e-17], N[Not[LessEqual[b, 2.2]], $MachinePrecision]], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{+146}:\\
\;\;\;\;\frac{-1}{\frac{a}{b} \cdot 1.5}\\
\mathbf{elif}\;b \leq -7.8 \cdot 10^{-155}:\\
\;\;\;\;\frac{\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 2.6 \cdot 10^{-130}:\\
\;\;\;\;\frac{-1}{\frac{a \cdot 3}{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}\\
\mathbf{elif}\;b \leq 6 \cdot 10^{-92}:\\
\;\;\;\;\left(b + \mathsf{hypot}\left(b, \sqrt{c \cdot -3} \cdot \sqrt{a}\right)\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{elif}\;b \leq 2.2 \cdot 10^{-17} \lor \neg \left(b \leq 2.2\right):\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\end{array}
\end{array}
if b < -1.99999999999999987e146Initial program 57.7%
/-rgt-identity57.7%
metadata-eval57.7%
associate-/l*57.7%
associate-*r/57.6%
*-commutative57.6%
associate-*l/57.7%
associate-*r/57.7%
metadata-eval57.7%
metadata-eval57.7%
times-frac57.7%
neg-mul-157.7%
distribute-rgt-neg-in57.7%
times-frac57.7%
metadata-eval57.7%
neg-mul-157.7%
Simplified57.7%
associate-*r/57.6%
associate-*r*57.6%
clear-num57.6%
frac-2neg57.6%
metadata-eval57.6%
*-un-lft-identity57.6%
associate-*r*57.6%
times-frac57.7%
metadata-eval57.7%
fma-udef57.7%
add-sqr-sqrt38.2%
Applied egg-rr55.4%
associate-*r/55.4%
metadata-eval55.4%
distribute-lft-neg-in55.4%
distribute-neg-frac55.4%
*-commutative55.4%
distribute-lft-neg-in55.4%
distribute-lft-neg-out55.4%
remove-double-neg55.4%
associate-*r*55.4%
*-commutative55.4%
metadata-eval55.4%
distribute-lft-neg-in55.4%
associate-*r*55.4%
distribute-lft-neg-out55.4%
*-commutative55.4%
*-commutative55.4%
distribute-rgt-neg-in55.4%
metadata-eval55.4%
Simplified55.4%
Taylor expanded in b around -inf 95.0%
*-commutative95.0%
Simplified95.0%
if -1.99999999999999987e146 < b < -7.8000000000000006e-155Initial program 87.4%
associate-*r*87.5%
cancel-sign-sub-inv87.5%
metadata-eval87.5%
*-commutative87.5%
associate-*r*87.5%
Applied egg-rr87.5%
if -7.8000000000000006e-155 < b < 2.6000000000000001e-130Initial program 69.5%
/-rgt-identity69.5%
metadata-eval69.5%
associate-/l*69.5%
associate-*r/69.4%
*-commutative69.4%
associate-*l/69.5%
associate-*r/69.5%
metadata-eval69.5%
metadata-eval69.5%
times-frac69.5%
neg-mul-169.5%
distribute-rgt-neg-in69.5%
times-frac69.3%
metadata-eval69.3%
neg-mul-169.3%
Simplified69.4%
associate-*r/69.3%
associate-*r*69.3%
clear-num69.1%
frac-2neg69.1%
metadata-eval69.1%
*-un-lft-identity69.1%
associate-*r*69.2%
times-frac69.4%
metadata-eval69.4%
fma-udef69.4%
add-sqr-sqrt69.4%
Applied egg-rr76.7%
associate-*r/76.8%
metadata-eval76.8%
distribute-lft-neg-in76.8%
distribute-neg-frac76.8%
*-commutative76.8%
distribute-lft-neg-in76.8%
distribute-lft-neg-out76.8%
remove-double-neg76.8%
associate-*r*76.8%
*-commutative76.8%
metadata-eval76.8%
distribute-lft-neg-in76.8%
associate-*r*76.8%
distribute-lft-neg-out76.8%
*-commutative76.8%
*-commutative76.8%
distribute-rgt-neg-in76.8%
metadata-eval76.8%
Simplified76.8%
if 2.6000000000000001e-130 < b < 6.00000000000000027e-92Initial program 45.0%
neg-sub045.0%
associate-+l-45.0%
sub0-neg45.0%
neg-mul-145.0%
associate-*r/45.0%
*-commutative45.0%
metadata-eval45.0%
metadata-eval45.0%
times-frac45.0%
*-commutative45.0%
times-frac45.0%
Simplified45.0%
sub-neg45.0%
fma-udef45.0%
add-sqr-sqrt45.0%
hypot-def45.0%
add-sqr-sqrt0.0%
sqrt-unprod45.0%
sqr-neg45.0%
sqrt-prod45.0%
add-sqr-sqrt45.0%
Applied egg-rr45.0%
sqrt-prod85.5%
Applied egg-rr85.5%
*-commutative85.5%
*-commutative85.5%
Simplified85.5%
if 6.00000000000000027e-92 < b < 2.2e-17 or 2.2000000000000002 < b Initial program 19.1%
Taylor expanded in b around inf 87.2%
if 2.2e-17 < b < 2.2000000000000002Initial program 83.6%
Taylor expanded in b around 0 83.6%
Final simplification86.1%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* a (* c -3.0))))
(if (<= b -8.5e+146)
(/ -1.0 (* (/ a b) 1.5))
(if (<= b -5e-152)
(/ (- (sqrt (+ (* b b) t_0)) b) (* a 3.0))
(if (<= b 2.9e-211)
(/ -1.0 (/ (* a 3.0) (- b (hypot b (sqrt (* c (* a -3.0)))))))
(if (<= b 2.9e-121)
(* (/ 0.3333333333333333 a) (+ b (hypot b (sqrt t_0))))
(if (or (<= b 2.2e-17) (not (<= b 2.2)))
(* -0.5 (/ c b))
(/ (- (sqrt (* -3.0 (* a c))) b) (* a 3.0)))))))))
double code(double a, double b, double c) {
double t_0 = a * (c * -3.0);
double tmp;
if (b <= -8.5e+146) {
tmp = -1.0 / ((a / b) * 1.5);
} else if (b <= -5e-152) {
tmp = (sqrt(((b * b) + t_0)) - b) / (a * 3.0);
} else if (b <= 2.9e-211) {
tmp = -1.0 / ((a * 3.0) / (b - hypot(b, sqrt((c * (a * -3.0))))));
} else if (b <= 2.9e-121) {
tmp = (0.3333333333333333 / a) * (b + hypot(b, sqrt(t_0)));
} else if ((b <= 2.2e-17) || !(b <= 2.2)) {
tmp = -0.5 * (c / b);
} else {
tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 3.0);
}
return tmp;
}
public static double code(double a, double b, double c) {
double t_0 = a * (c * -3.0);
double tmp;
if (b <= -8.5e+146) {
tmp = -1.0 / ((a / b) * 1.5);
} else if (b <= -5e-152) {
tmp = (Math.sqrt(((b * b) + t_0)) - b) / (a * 3.0);
} else if (b <= 2.9e-211) {
tmp = -1.0 / ((a * 3.0) / (b - Math.hypot(b, Math.sqrt((c * (a * -3.0))))));
} else if (b <= 2.9e-121) {
tmp = (0.3333333333333333 / a) * (b + Math.hypot(b, Math.sqrt(t_0)));
} else if ((b <= 2.2e-17) || !(b <= 2.2)) {
tmp = -0.5 * (c / b);
} else {
tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0);
}
return tmp;
}
def code(a, b, c): t_0 = a * (c * -3.0) tmp = 0 if b <= -8.5e+146: tmp = -1.0 / ((a / b) * 1.5) elif b <= -5e-152: tmp = (math.sqrt(((b * b) + t_0)) - b) / (a * 3.0) elif b <= 2.9e-211: tmp = -1.0 / ((a * 3.0) / (b - math.hypot(b, math.sqrt((c * (a * -3.0)))))) elif b <= 2.9e-121: tmp = (0.3333333333333333 / a) * (b + math.hypot(b, math.sqrt(t_0))) elif (b <= 2.2e-17) or not (b <= 2.2): tmp = -0.5 * (c / b) else: tmp = (math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0) return tmp
function code(a, b, c) t_0 = Float64(a * Float64(c * -3.0)) tmp = 0.0 if (b <= -8.5e+146) tmp = Float64(-1.0 / Float64(Float64(a / b) * 1.5)); elseif (b <= -5e-152) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) + t_0)) - b) / Float64(a * 3.0)); elseif (b <= 2.9e-211) tmp = Float64(-1.0 / Float64(Float64(a * 3.0) / Float64(b - hypot(b, sqrt(Float64(c * Float64(a * -3.0))))))); elseif (b <= 2.9e-121) tmp = Float64(Float64(0.3333333333333333 / a) * Float64(b + hypot(b, sqrt(t_0)))); elseif ((b <= 2.2e-17) || !(b <= 2.2)) tmp = Float64(-0.5 * Float64(c / b)); else tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(a * 3.0)); end return tmp end
function tmp_2 = code(a, b, c) t_0 = a * (c * -3.0); tmp = 0.0; if (b <= -8.5e+146) tmp = -1.0 / ((a / b) * 1.5); elseif (b <= -5e-152) tmp = (sqrt(((b * b) + t_0)) - b) / (a * 3.0); elseif (b <= 2.9e-211) tmp = -1.0 / ((a * 3.0) / (b - hypot(b, sqrt((c * (a * -3.0)))))); elseif (b <= 2.9e-121) tmp = (0.3333333333333333 / a) * (b + hypot(b, sqrt(t_0))); elseif ((b <= 2.2e-17) || ~((b <= 2.2))) tmp = -0.5 * (c / b); else tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 3.0); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -8.5e+146], N[(-1.0 / N[(N[(a / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -5e-152], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.9e-211], N[(-1.0 / N[(N[(a * 3.0), $MachinePrecision] / N[(b - N[Sqrt[b ^ 2 + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.9e-121], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(b + N[Sqrt[b ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 2.2e-17], N[Not[LessEqual[b, 2.2]], $MachinePrecision]], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(c \cdot -3\right)\\
\mathbf{if}\;b \leq -8.5 \cdot 10^{+146}:\\
\;\;\;\;\frac{-1}{\frac{a}{b} \cdot 1.5}\\
\mathbf{elif}\;b \leq -5 \cdot 10^{-152}:\\
\;\;\;\;\frac{\sqrt{b \cdot b + t_0} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 2.9 \cdot 10^{-211}:\\
\;\;\;\;\frac{-1}{\frac{a \cdot 3}{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}\\
\mathbf{elif}\;b \leq 2.9 \cdot 10^{-121}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{t_0}\right)\right)\\
\mathbf{elif}\;b \leq 2.2 \cdot 10^{-17} \lor \neg \left(b \leq 2.2\right):\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\end{array}
\end{array}
if b < -8.5e146Initial program 57.7%
/-rgt-identity57.7%
metadata-eval57.7%
associate-/l*57.7%
associate-*r/57.6%
*-commutative57.6%
associate-*l/57.7%
associate-*r/57.7%
metadata-eval57.7%
metadata-eval57.7%
times-frac57.7%
neg-mul-157.7%
distribute-rgt-neg-in57.7%
times-frac57.7%
metadata-eval57.7%
neg-mul-157.7%
Simplified57.7%
associate-*r/57.6%
associate-*r*57.6%
clear-num57.6%
frac-2neg57.6%
metadata-eval57.6%
*-un-lft-identity57.6%
associate-*r*57.6%
times-frac57.7%
metadata-eval57.7%
fma-udef57.7%
add-sqr-sqrt38.2%
Applied egg-rr55.4%
associate-*r/55.4%
metadata-eval55.4%
distribute-lft-neg-in55.4%
distribute-neg-frac55.4%
*-commutative55.4%
distribute-lft-neg-in55.4%
distribute-lft-neg-out55.4%
remove-double-neg55.4%
associate-*r*55.4%
*-commutative55.4%
metadata-eval55.4%
distribute-lft-neg-in55.4%
associate-*r*55.4%
distribute-lft-neg-out55.4%
*-commutative55.4%
*-commutative55.4%
distribute-rgt-neg-in55.4%
metadata-eval55.4%
Simplified55.4%
Taylor expanded in b around -inf 95.0%
*-commutative95.0%
Simplified95.0%
if -8.5e146 < b < -4.9999999999999997e-152Initial program 87.4%
associate-*r*87.5%
cancel-sign-sub-inv87.5%
metadata-eval87.5%
*-commutative87.5%
associate-*r*87.5%
Applied egg-rr87.5%
if -4.9999999999999997e-152 < b < 2.90000000000000014e-211Initial program 69.5%
/-rgt-identity69.5%
metadata-eval69.5%
associate-/l*69.5%
associate-*r/69.4%
*-commutative69.4%
associate-*l/69.5%
associate-*r/69.5%
metadata-eval69.5%
metadata-eval69.5%
times-frac69.5%
neg-mul-169.5%
distribute-rgt-neg-in69.5%
times-frac69.2%
metadata-eval69.2%
neg-mul-169.2%
Simplified69.3%
associate-*r/69.2%
associate-*r*69.2%
clear-num69.1%
frac-2neg69.1%
metadata-eval69.1%
*-un-lft-identity69.1%
associate-*r*69.2%
times-frac69.4%
metadata-eval69.4%
fma-udef69.4%
add-sqr-sqrt69.4%
Applied egg-rr78.9%
associate-*r/79.1%
metadata-eval79.1%
distribute-lft-neg-in79.1%
distribute-neg-frac79.1%
*-commutative79.1%
distribute-lft-neg-in79.1%
distribute-lft-neg-out79.1%
remove-double-neg79.1%
associate-*r*79.0%
*-commutative79.0%
metadata-eval79.0%
distribute-lft-neg-in79.0%
associate-*r*79.1%
distribute-lft-neg-out79.1%
*-commutative79.1%
*-commutative79.1%
distribute-rgt-neg-in79.1%
metadata-eval79.1%
Simplified79.1%
if 2.90000000000000014e-211 < b < 2.9e-121Initial program 69.3%
neg-sub069.3%
associate-+l-69.3%
sub0-neg69.3%
neg-mul-169.3%
associate-*r/69.3%
*-commutative69.3%
metadata-eval69.3%
metadata-eval69.3%
times-frac69.3%
*-commutative69.3%
times-frac69.3%
Simplified69.2%
sub-neg69.2%
fma-udef69.2%
add-sqr-sqrt69.2%
hypot-def69.3%
add-sqr-sqrt0.0%
sqrt-unprod69.7%
sqr-neg69.7%
sqrt-prod69.7%
add-sqr-sqrt69.7%
Applied egg-rr69.7%
if 2.9e-121 < b < 2.2e-17 or 2.2000000000000002 < b Initial program 19.5%
Taylor expanded in b around inf 84.6%
if 2.2e-17 < b < 2.2000000000000002Initial program 83.6%
Taylor expanded in b around 0 83.6%
Final simplification85.0%
(FPCore (a b c)
:precision binary64
(if (<= b -3.8e-57)
(+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5))
(if (or (<= b 1.3e-121) (and (not (<= b 1.95e-17)) (<= b 2.2)))
(/ (- (sqrt (* -3.0 (* a c))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.8e-57) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if ((b <= 1.3e-121) || (!(b <= 1.95e-17) && (b <= 2.2))) {
tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 3.0);
} 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 <= (-3.8d-57)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else if ((b <= 1.3d-121) .or. (.not. (b <= 1.95d-17)) .and. (b <= 2.2d0)) then
tmp = (sqrt(((-3.0d0) * (a * c))) - b) / (a * 3.0d0)
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 <= -3.8e-57) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if ((b <= 1.3e-121) || (!(b <= 1.95e-17) && (b <= 2.2))) {
tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.8e-57: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) elif (b <= 1.3e-121) or (not (b <= 1.95e-17) and (b <= 2.2)): tmp = (math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.8e-57) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); elseif ((b <= 1.3e-121) || (!(b <= 1.95e-17) && (b <= 2.2))) tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(a * 3.0)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.8e-57) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); elseif ((b <= 1.3e-121) || (~((b <= 1.95e-17)) && (b <= 2.2))) tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.8e-57], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1.3e-121], And[N[Not[LessEqual[b, 1.95e-17]], $MachinePrecision], LessEqual[b, 2.2]]], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.8 \cdot 10^{-57}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 1.3 \cdot 10^{-121} \lor \neg \left(b \leq 1.95 \cdot 10^{-17}\right) \land b \leq 2.2:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -3.7999999999999997e-57Initial program 74.7%
Taylor expanded in b around -inf 84.0%
if -3.7999999999999997e-57 < b < 1.29999999999999993e-121 or 1.94999999999999995e-17 < b < 2.2000000000000002Initial program 73.5%
Taylor expanded in b around 0 68.0%
if 1.29999999999999993e-121 < b < 1.94999999999999995e-17 or 2.2000000000000002 < b Initial program 19.5%
Taylor expanded in b around inf 84.6%
Final simplification79.4%
(FPCore (a b c)
:precision binary64
(if (<= b -7e-63)
(+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5))
(if (<= b 5.6e-121)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(if (or (<= b 3.7e-19) (not (<= b 2.2)))
(* -0.5 (/ c b))
(/ (- (sqrt (* -3.0 (* a c))) b) (* a 3.0))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7e-63) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 5.6e-121) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else if ((b <= 3.7e-19) || !(b <= 2.2)) {
tmp = -0.5 * (c / b);
} else {
tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 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 <= (-7d-63)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else if (b <= 5.6d-121) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
else if ((b <= 3.7d-19) .or. (.not. (b <= 2.2d0))) then
tmp = (-0.5d0) * (c / b)
else
tmp = (sqrt(((-3.0d0) * (a * c))) - b) / (a * 3.0d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -7e-63) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 5.6e-121) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else if ((b <= 3.7e-19) || !(b <= 2.2)) {
tmp = -0.5 * (c / b);
} else {
tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7e-63: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) elif b <= 5.6e-121: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) elif (b <= 3.7e-19) or not (b <= 2.2): tmp = -0.5 * (c / b) else: tmp = (math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7e-63) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); elseif (b <= 5.6e-121) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); elseif ((b <= 3.7e-19) || !(b <= 2.2)) tmp = Float64(-0.5 * Float64(c / b)); else tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(a * 3.0)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -7e-63) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); elseif (b <= 5.6e-121) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); elseif ((b <= 3.7e-19) || ~((b <= 2.2))) tmp = -0.5 * (c / b); else tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 3.0); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7e-63], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.6e-121], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 3.7e-19], N[Not[LessEqual[b, 2.2]], $MachinePrecision]], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7 \cdot 10^{-63}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 5.6 \cdot 10^{-121}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 3.7 \cdot 10^{-19} \lor \neg \left(b \leq 2.2\right):\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\end{array}
\end{array}
if b < -7.00000000000000006e-63Initial program 74.7%
Taylor expanded in b around -inf 84.0%
if -7.00000000000000006e-63 < b < 5.6000000000000002e-121Initial program 72.6%
Taylor expanded in b around 0 66.7%
*-commutative66.7%
metadata-eval66.7%
distribute-lft-neg-in66.7%
associate-*r*66.8%
distribute-lft-neg-out66.8%
*-commutative66.8%
*-commutative66.8%
distribute-rgt-neg-in66.8%
metadata-eval66.8%
Simplified66.8%
if 5.6000000000000002e-121 < b < 3.70000000000000005e-19 or 2.2000000000000002 < b Initial program 19.5%
Taylor expanded in b around inf 84.6%
if 3.70000000000000005e-19 < b < 2.2000000000000002Initial program 83.6%
Taylor expanded in b around 0 83.6%
Final simplification79.4%
(FPCore (a b c)
:precision binary64
(if (<= b -1e+147)
(/ -1.0 (* (/ a b) 1.5))
(if (<= b 5.6e-121)
(/ (- (sqrt (+ (* b b) (* a (* c -3.0)))) b) (* a 3.0))
(if (or (<= b 2.2e-17) (not (<= b 2.3)))
(* -0.5 (/ c b))
(/ (- (sqrt (* -3.0 (* a c))) b) (* a 3.0))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e+147) {
tmp = -1.0 / ((a / b) * 1.5);
} else if (b <= 5.6e-121) {
tmp = (sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0);
} else if ((b <= 2.2e-17) || !(b <= 2.3)) {
tmp = -0.5 * (c / b);
} else {
tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 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 <= (-1d+147)) then
tmp = (-1.0d0) / ((a / b) * 1.5d0)
else if (b <= 5.6d-121) then
tmp = (sqrt(((b * b) + (a * (c * (-3.0d0))))) - b) / (a * 3.0d0)
else if ((b <= 2.2d-17) .or. (.not. (b <= 2.3d0))) then
tmp = (-0.5d0) * (c / b)
else
tmp = (sqrt(((-3.0d0) * (a * c))) - b) / (a * 3.0d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e+147) {
tmp = -1.0 / ((a / b) * 1.5);
} else if (b <= 5.6e-121) {
tmp = (Math.sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0);
} else if ((b <= 2.2e-17) || !(b <= 2.3)) {
tmp = -0.5 * (c / b);
} else {
tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e+147: tmp = -1.0 / ((a / b) * 1.5) elif b <= 5.6e-121: tmp = (math.sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0) elif (b <= 2.2e-17) or not (b <= 2.3): tmp = -0.5 * (c / b) else: tmp = (math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e+147) tmp = Float64(-1.0 / Float64(Float64(a / b) * 1.5)); elseif (b <= 5.6e-121) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -3.0)))) - b) / Float64(a * 3.0)); elseif ((b <= 2.2e-17) || !(b <= 2.3)) tmp = Float64(-0.5 * Float64(c / b)); else tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(a * 3.0)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e+147) tmp = -1.0 / ((a / b) * 1.5); elseif (b <= 5.6e-121) tmp = (sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0); elseif ((b <= 2.2e-17) || ~((b <= 2.3))) tmp = -0.5 * (c / b); else tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 3.0); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e+147], N[(-1.0 / N[(N[(a / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.6e-121], 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], If[Or[LessEqual[b, 2.2e-17], N[Not[LessEqual[b, 2.3]], $MachinePrecision]], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+147}:\\
\;\;\;\;\frac{-1}{\frac{a}{b} \cdot 1.5}\\
\mathbf{elif}\;b \leq 5.6 \cdot 10^{-121}:\\
\;\;\;\;\frac{\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 2.2 \cdot 10^{-17} \lor \neg \left(b \leq 2.3\right):\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\end{array}
\end{array}
if b < -9.9999999999999998e146Initial program 57.7%
/-rgt-identity57.7%
metadata-eval57.7%
associate-/l*57.7%
associate-*r/57.6%
*-commutative57.6%
associate-*l/57.7%
associate-*r/57.7%
metadata-eval57.7%
metadata-eval57.7%
times-frac57.7%
neg-mul-157.7%
distribute-rgt-neg-in57.7%
times-frac57.7%
metadata-eval57.7%
neg-mul-157.7%
Simplified57.7%
associate-*r/57.6%
associate-*r*57.6%
clear-num57.6%
frac-2neg57.6%
metadata-eval57.6%
*-un-lft-identity57.6%
associate-*r*57.6%
times-frac57.7%
metadata-eval57.7%
fma-udef57.7%
add-sqr-sqrt38.2%
Applied egg-rr55.4%
associate-*r/55.4%
metadata-eval55.4%
distribute-lft-neg-in55.4%
distribute-neg-frac55.4%
*-commutative55.4%
distribute-lft-neg-in55.4%
distribute-lft-neg-out55.4%
remove-double-neg55.4%
associate-*r*55.4%
*-commutative55.4%
metadata-eval55.4%
distribute-lft-neg-in55.4%
associate-*r*55.4%
distribute-lft-neg-out55.4%
*-commutative55.4%
*-commutative55.4%
distribute-rgt-neg-in55.4%
metadata-eval55.4%
Simplified55.4%
Taylor expanded in b around -inf 95.0%
*-commutative95.0%
Simplified95.0%
if -9.9999999999999998e146 < b < 5.6000000000000002e-121Initial program 78.8%
associate-*r*78.8%
cancel-sign-sub-inv78.8%
metadata-eval78.8%
*-commutative78.8%
associate-*r*78.8%
Applied egg-rr78.8%
if 5.6000000000000002e-121 < b < 2.2e-17 or 2.2999999999999998 < b Initial program 19.5%
Taylor expanded in b around inf 84.6%
if 2.2e-17 < b < 2.2999999999999998Initial program 83.6%
Taylor expanded in b around 0 83.6%
Final simplification83.4%
(FPCore (a b c) :precision binary64 (if (<= b -1e-309) (+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-309) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} 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 <= (-1d-309)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
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 <= -1e-309) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-309: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-309) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-309) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-309], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.000000000000002e-309Initial program 74.3%
Taylor expanded in b around -inf 68.1%
if -1.000000000000002e-309 < b Initial program 36.2%
Taylor expanded in b around inf 61.4%
Final simplification64.7%
(FPCore (a b c) :precision binary64 (if (<= b -1e-309) (/ -1.0 (/ (* a 1.5) b)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-309) {
tmp = -1.0 / ((a * 1.5) / 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 <= (-1d-309)) then
tmp = (-1.0d0) / ((a * 1.5d0) / 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 <= -1e-309) {
tmp = -1.0 / ((a * 1.5) / b);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-309: tmp = -1.0 / ((a * 1.5) / b) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-309) tmp = Float64(-1.0 / Float64(Float64(a * 1.5) / 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 <= -1e-309) tmp = -1.0 / ((a * 1.5) / b); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-309], N[(-1.0 / N[(N[(a * 1.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{-1}{\frac{a \cdot 1.5}{b}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.000000000000002e-309Initial program 74.3%
/-rgt-identity74.3%
metadata-eval74.3%
associate-/l*74.3%
associate-*r/74.3%
*-commutative74.3%
associate-*l/74.3%
associate-*r/74.3%
metadata-eval74.3%
metadata-eval74.3%
times-frac74.3%
neg-mul-174.3%
distribute-rgt-neg-in74.3%
times-frac74.1%
metadata-eval74.1%
neg-mul-174.1%
Simplified74.2%
associate-*r/74.2%
associate-*r*74.2%
clear-num74.2%
frac-2neg74.2%
metadata-eval74.2%
*-un-lft-identity74.2%
associate-*r*74.2%
times-frac74.2%
metadata-eval74.2%
fma-udef74.2%
add-sqr-sqrt56.3%
Applied egg-rr64.7%
associate-*r/64.8%
metadata-eval64.8%
distribute-lft-neg-in64.8%
distribute-neg-frac64.8%
*-commutative64.8%
distribute-lft-neg-in64.8%
distribute-lft-neg-out64.8%
remove-double-neg64.8%
associate-*r*64.7%
*-commutative64.7%
metadata-eval64.7%
distribute-lft-neg-in64.7%
associate-*r*64.8%
distribute-lft-neg-out64.8%
*-commutative64.8%
*-commutative64.8%
distribute-rgt-neg-in64.8%
metadata-eval64.8%
Simplified64.8%
Taylor expanded in b around -inf 67.7%
*-commutative67.7%
Simplified67.7%
associate-*l/67.7%
Applied egg-rr67.7%
if -1.000000000000002e-309 < b Initial program 36.2%
Taylor expanded in b around inf 61.4%
Final simplification64.5%
(FPCore (a b c) :precision binary64 (if (<= b -1e-309) (/ (* b -2.0) (* a 3.0)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-309) {
tmp = (b * -2.0) / (a * 3.0);
} 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 <= (-1d-309)) then
tmp = (b * (-2.0d0)) / (a * 3.0d0)
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 <= -1e-309) {
tmp = (b * -2.0) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-309: tmp = (b * -2.0) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-309) tmp = Float64(Float64(b * -2.0) / Float64(a * 3.0)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-309) tmp = (b * -2.0) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-309], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.000000000000002e-309Initial program 74.3%
Taylor expanded in b around -inf 67.8%
*-commutative67.8%
Simplified67.8%
if -1.000000000000002e-309 < b Initial program 36.2%
Taylor expanded in b around inf 61.4%
Final simplification64.5%
(FPCore (a b c) :precision binary64 (if (<= b -1e-309) (* -0.6666666666666666 (/ b a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-309) {
tmp = -0.6666666666666666 * (b / a);
} 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 <= (-1d-309)) then
tmp = (-0.6666666666666666d0) * (b / a)
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 <= -1e-309) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-309: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-309) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-309) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-309], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.000000000000002e-309Initial program 74.3%
Taylor expanded in b around -inf 67.7%
*-commutative67.7%
Simplified67.7%
if -1.000000000000002e-309 < b Initial program 36.2%
Taylor expanded in b around inf 61.4%
Final simplification64.4%
(FPCore (a b c) :precision binary64 (if (<= b -1e-309) (/ b (/ a -0.6666666666666666)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-309) {
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 <= (-1d-309)) 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 <= -1e-309) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-309: tmp = b / (a / -0.6666666666666666) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-309) tmp = Float64(b / Float64(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 <= -1e-309) tmp = b / (a / -0.6666666666666666); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-309], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.000000000000002e-309Initial program 74.3%
/-rgt-identity74.3%
metadata-eval74.3%
associate-/l*74.3%
associate-*r/74.3%
*-commutative74.3%
associate-*l/74.3%
associate-*r/74.3%
metadata-eval74.3%
metadata-eval74.3%
times-frac74.3%
neg-mul-174.3%
distribute-rgt-neg-in74.3%
times-frac74.1%
metadata-eval74.1%
neg-mul-174.1%
Simplified74.2%
associate-*r/74.2%
associate-*r*74.2%
clear-num74.2%
frac-2neg74.2%
metadata-eval74.2%
*-un-lft-identity74.2%
associate-*r*74.2%
times-frac74.2%
metadata-eval74.2%
fma-udef74.2%
add-sqr-sqrt56.3%
Applied egg-rr64.7%
associate-*r/64.8%
metadata-eval64.8%
distribute-lft-neg-in64.8%
distribute-neg-frac64.8%
*-commutative64.8%
distribute-lft-neg-in64.8%
distribute-lft-neg-out64.8%
remove-double-neg64.8%
associate-*r*64.7%
*-commutative64.7%
metadata-eval64.7%
distribute-lft-neg-in64.7%
associate-*r*64.8%
distribute-lft-neg-out64.8%
*-commutative64.8%
*-commutative64.8%
distribute-rgt-neg-in64.8%
metadata-eval64.8%
Simplified64.8%
Taylor expanded in b around -inf 67.7%
*-commutative67.7%
associate-/r/67.7%
Simplified67.7%
if -1.000000000000002e-309 < b Initial program 36.2%
Taylor expanded in b around inf 61.4%
Final simplification64.5%
(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 54.7%
Taylor expanded in b around inf 32.7%
Final simplification32.7%
(FPCore (a b c) :precision binary64 0.0)
double code(double a, double b, double c) {
return 0.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.0d0
end function
public static double code(double a, double b, double c) {
return 0.0;
}
def code(a, b, c): return 0.0
function code(a, b, c) return 0.0 end
function tmp = code(a, b, c) tmp = 0.0; end
code[a_, b_, c_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 54.7%
Taylor expanded in b around inf 30.1%
unpow230.1%
Simplified30.1%
Taylor expanded in b around 0 12.1%
Final simplification12.1%
herbie shell --seed 2023224
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))