
(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 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (+ b (hypot b (sqrt (* c (* a -3.0)))))))
(if (<= b -1.6e+161)
(/ (* b -2.0) (* 3.0 a))
(if (<= b 8.6e-130)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
(if (or (<= b 1100.0) (not (<= b 15000000.0)))
(/ (* c -0.5) b)
(/
(- (/ (fma c (* a -3.0) (pow b 2.0)) t_0) (/ (pow b 2.0) t_0))
(* 3.0 a)))))))
double code(double a, double b, double c) {
double t_0 = b + hypot(b, sqrt((c * (a * -3.0))));
double tmp;
if (b <= -1.6e+161) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 8.6e-130) {
tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
} else if ((b <= 1100.0) || !(b <= 15000000.0)) {
tmp = (c * -0.5) / b;
} else {
tmp = ((fma(c, (a * -3.0), pow(b, 2.0)) / t_0) - (pow(b, 2.0) / t_0)) / (3.0 * a);
}
return tmp;
}
function code(a, b, c) t_0 = Float64(b + hypot(b, sqrt(Float64(c * Float64(a * -3.0))))) tmp = 0.0 if (b <= -1.6e+161) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a)); elseif (b <= 8.6e-130) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)); elseif ((b <= 1100.0) || !(b <= 15000000.0)) tmp = Float64(Float64(c * -0.5) / b); else tmp = Float64(Float64(Float64(fma(c, Float64(a * -3.0), (b ^ 2.0)) / t_0) - Float64((b ^ 2.0) / t_0)) / Float64(3.0 * a)); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(b + N[Sqrt[b ^ 2 + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.6e+161], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.6e-130], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1100.0], N[Not[LessEqual[b, 15000000.0]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(N[(N[(N[(c * N[(a * -3.0), $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] - N[(N[Power[b, 2.0], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\\
\mathbf{if}\;b \leq -1.6 \cdot 10^{+161}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq 8.6 \cdot 10^{-130}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 15000000\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}{t\_0} - \frac{{b}^{2}}{t\_0}}{3 \cdot a}\\
\end{array}
\end{array}
if b < -1.60000000000000001e161Initial program 23.9%
Taylor expanded in b around -inf 95.3%
*-commutative95.3%
Simplified95.3%
if -1.60000000000000001e161 < b < 8.60000000000000058e-130Initial program 86.3%
if 8.60000000000000058e-130 < b < 1100 or 1.5e7 < b Initial program 18.6%
Taylor expanded in b around inf 85.7%
associate-*r/85.7%
Simplified85.7%
if 1100 < b < 1.5e7Initial program 99.4%
Applied egg-rr100.0%
fma-udef100.0%
unpow2100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Final simplification87.7%
(FPCore (a b c)
:precision binary64
(if (<= b -6.2e-117)
(+ (/ -0.6666666666666666 (/ a b)) (* 0.5 (/ c b)))
(if (or (<= b 8.6e-130) (and (not (<= b 1100.0)) (<= b 11000000.0)))
(* 0.3333333333333333 (/ (+ b (sqrt (* c (* a -3.0)))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.2e-117) {
tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
} else if ((b <= 8.6e-130) || (!(b <= 1100.0) && (b <= 11000000.0))) {
tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / 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 <= (-6.2d-117)) then
tmp = ((-0.6666666666666666d0) / (a / b)) + (0.5d0 * (c / b))
else if ((b <= 8.6d-130) .or. (.not. (b <= 1100.0d0)) .and. (b <= 11000000.0d0)) then
tmp = 0.3333333333333333d0 * ((b + sqrt((c * (a * (-3.0d0))))) / 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 <= -6.2e-117) {
tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
} else if ((b <= 8.6e-130) || (!(b <= 1100.0) && (b <= 11000000.0))) {
tmp = 0.3333333333333333 * ((b + Math.sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.2e-117: tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b)) elif (b <= 8.6e-130) or (not (b <= 1100.0) and (b <= 11000000.0)): tmp = 0.3333333333333333 * ((b + math.sqrt((c * (a * -3.0)))) / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.2e-117) tmp = Float64(Float64(-0.6666666666666666 / Float64(a / b)) + Float64(0.5 * Float64(c / b))); elseif ((b <= 8.6e-130) || (!(b <= 1100.0) && (b <= 11000000.0))) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) / 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 <= -6.2e-117) tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b)); elseif ((b <= 8.6e-130) || (~((b <= 1100.0)) && (b <= 11000000.0))) tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.2e-117], N[(N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 8.6e-130], And[N[Not[LessEqual[b, 1100.0]], $MachinePrecision], LessEqual[b, 11000000.0]]], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(c * N[(a * -3.0), $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 -6.2 \cdot 10^{-117}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 8.6 \cdot 10^{-130} \lor \neg \left(b \leq 1100\right) \land b \leq 11000000:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -6.20000000000000022e-117Initial program 64.1%
Taylor expanded in b around -inf 87.1%
clear-num87.0%
un-div-inv87.2%
Applied egg-rr87.2%
if -6.20000000000000022e-117 < b < 8.60000000000000058e-130 or 1100 < b < 1.1e7Initial program 82.1%
Taylor expanded in b around 0 81.5%
*-un-lft-identity81.5%
times-frac81.3%
metadata-eval81.3%
add-sqr-sqrt40.3%
sqrt-unprod80.6%
sqr-neg80.6%
sqrt-unprod41.0%
add-sqr-sqrt80.3%
associate-*r*80.3%
*-commutative80.3%
*-commutative80.3%
Applied egg-rr80.3%
if 8.60000000000000058e-130 < b < 1100 or 1.1e7 < b Initial program 18.6%
Taylor expanded in b around inf 85.7%
associate-*r/85.7%
Simplified85.7%
Final simplification85.1%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (+ b (sqrt (* c (* a -3.0))))))
(if (<= b -1.15e-110)
(+ (/ -0.6666666666666666 (/ a b)) (* 0.5 (/ c b)))
(if (<= b 8.6e-130)
(* 0.3333333333333333 (/ t_0 a))
(if (or (<= b 1100.0) (not (<= b 12000000.0)))
(/ (* c -0.5) b)
(* t_0 (/ 0.3333333333333333 a)))))))
double code(double a, double b, double c) {
double t_0 = b + sqrt((c * (a * -3.0)));
double tmp;
if (b <= -1.15e-110) {
tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
} else if (b <= 8.6e-130) {
tmp = 0.3333333333333333 * (t_0 / a);
} else if ((b <= 1100.0) || !(b <= 12000000.0)) {
tmp = (c * -0.5) / b;
} else {
tmp = t_0 * (0.3333333333333333 / a);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = b + sqrt((c * (a * (-3.0d0))))
if (b <= (-1.15d-110)) then
tmp = ((-0.6666666666666666d0) / (a / b)) + (0.5d0 * (c / b))
else if (b <= 8.6d-130) then
tmp = 0.3333333333333333d0 * (t_0 / a)
else if ((b <= 1100.0d0) .or. (.not. (b <= 12000000.0d0))) then
tmp = (c * (-0.5d0)) / b
else
tmp = t_0 * (0.3333333333333333d0 / a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = b + Math.sqrt((c * (a * -3.0)));
double tmp;
if (b <= -1.15e-110) {
tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
} else if (b <= 8.6e-130) {
tmp = 0.3333333333333333 * (t_0 / a);
} else if ((b <= 1100.0) || !(b <= 12000000.0)) {
tmp = (c * -0.5) / b;
} else {
tmp = t_0 * (0.3333333333333333 / a);
}
return tmp;
}
def code(a, b, c): t_0 = b + math.sqrt((c * (a * -3.0))) tmp = 0 if b <= -1.15e-110: tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b)) elif b <= 8.6e-130: tmp = 0.3333333333333333 * (t_0 / a) elif (b <= 1100.0) or not (b <= 12000000.0): tmp = (c * -0.5) / b else: tmp = t_0 * (0.3333333333333333 / a) return tmp
function code(a, b, c) t_0 = Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) tmp = 0.0 if (b <= -1.15e-110) tmp = Float64(Float64(-0.6666666666666666 / Float64(a / b)) + Float64(0.5 * Float64(c / b))); elseif (b <= 8.6e-130) tmp = Float64(0.3333333333333333 * Float64(t_0 / a)); elseif ((b <= 1100.0) || !(b <= 12000000.0)) tmp = Float64(Float64(c * -0.5) / b); else tmp = Float64(t_0 * Float64(0.3333333333333333 / a)); end return tmp end
function tmp_2 = code(a, b, c) t_0 = b + sqrt((c * (a * -3.0))); tmp = 0.0; if (b <= -1.15e-110) tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b)); elseif (b <= 8.6e-130) tmp = 0.3333333333333333 * (t_0 / a); elseif ((b <= 1100.0) || ~((b <= 12000000.0))) tmp = (c * -0.5) / b; else tmp = t_0 * (0.3333333333333333 / a); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.15e-110], N[(N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.6e-130], N[(0.3333333333333333 * N[(t$95$0 / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1100.0], N[Not[LessEqual[b, 12000000.0]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(t$95$0 * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b + \sqrt{c \cdot \left(a \cdot -3\right)}\\
\mathbf{if}\;b \leq -1.15 \cdot 10^{-110}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 8.6 \cdot 10^{-130}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{t\_0}{a}\\
\mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 12000000\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{0.3333333333333333}{a}\\
\end{array}
\end{array}
if b < -1.1500000000000001e-110Initial program 64.1%
Taylor expanded in b around -inf 87.1%
clear-num87.0%
un-div-inv87.2%
Applied egg-rr87.2%
if -1.1500000000000001e-110 < b < 8.60000000000000058e-130Initial program 80.4%
Taylor expanded in b around 0 79.7%
*-un-lft-identity79.7%
times-frac79.6%
metadata-eval79.6%
add-sqr-sqrt44.3%
sqrt-unprod78.9%
sqr-neg78.9%
sqrt-unprod35.4%
add-sqr-sqrt78.5%
associate-*r*78.5%
*-commutative78.5%
*-commutative78.5%
Applied egg-rr78.5%
if 8.60000000000000058e-130 < b < 1100 or 1.2e7 < b Initial program 18.6%
Taylor expanded in b around inf 85.7%
associate-*r/85.7%
Simplified85.7%
if 1100 < b < 1.2e7Initial program 99.4%
Taylor expanded in b around 0 99.7%
expm1-log1p-u59.7%
expm1-udef2.5%
div-inv2.5%
add-sqr-sqrt0.0%
sqrt-unprod2.5%
sqr-neg2.5%
sqrt-unprod2.5%
add-sqr-sqrt2.5%
associate-*r*2.5%
*-commutative2.5%
*-commutative2.5%
associate-/r*2.5%
metadata-eval2.5%
Applied egg-rr2.5%
expm1-def59.1%
expm1-log1p98.8%
*-commutative98.8%
Simplified98.8%
Final simplification85.1%
(FPCore (a b c)
:precision binary64
(if (<= b -1.02e-96)
(+ (/ -0.6666666666666666 (/ a b)) (* 0.5 (/ c b)))
(if (or (<= b 4.1e-132) (and (not (<= b 600.0)) (<= b 11000000.0)))
(/ (- (sqrt (* a (* c -3.0))) b) (* 3.0 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.02e-96) {
tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
} else if ((b <= 4.1e-132) || (!(b <= 600.0) && (b <= 11000000.0))) {
tmp = (sqrt((a * (c * -3.0))) - b) / (3.0 * 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 <= (-1.02d-96)) then
tmp = ((-0.6666666666666666d0) / (a / b)) + (0.5d0 * (c / b))
else if ((b <= 4.1d-132) .or. (.not. (b <= 600.0d0)) .and. (b <= 11000000.0d0)) then
tmp = (sqrt((a * (c * (-3.0d0)))) - b) / (3.0d0 * 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 <= -1.02e-96) {
tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
} else if ((b <= 4.1e-132) || (!(b <= 600.0) && (b <= 11000000.0))) {
tmp = (Math.sqrt((a * (c * -3.0))) - b) / (3.0 * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.02e-96: tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b)) elif (b <= 4.1e-132) or (not (b <= 600.0) and (b <= 11000000.0)): tmp = (math.sqrt((a * (c * -3.0))) - b) / (3.0 * a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.02e-96) tmp = Float64(Float64(-0.6666666666666666 / Float64(a / b)) + Float64(0.5 * Float64(c / b))); elseif ((b <= 4.1e-132) || (!(b <= 600.0) && (b <= 11000000.0))) tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / Float64(3.0 * 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 <= -1.02e-96) tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b)); elseif ((b <= 4.1e-132) || (~((b <= 600.0)) && (b <= 11000000.0))) tmp = (sqrt((a * (c * -3.0))) - b) / (3.0 * a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.02e-96], N[(N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 4.1e-132], And[N[Not[LessEqual[b, 600.0]], $MachinePrecision], LessEqual[b, 11000000.0]]], N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.02 \cdot 10^{-96}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 4.1 \cdot 10^{-132} \lor \neg \left(b \leq 600\right) \land b \leq 11000000:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.02000000000000007e-96Initial program 63.4%
Taylor expanded in b around -inf 87.8%
clear-num87.8%
un-div-inv87.9%
Applied egg-rr87.9%
if -1.02000000000000007e-96 < b < 4.10000000000000007e-132 or 600 < b < 1.1e7Initial program 82.7%
Taylor expanded in b around 0 80.7%
+-commutative80.7%
unsub-neg80.7%
associate-*r*80.7%
*-commutative80.7%
*-commutative80.7%
Applied egg-rr80.7%
*-commutative80.7%
associate-*l*80.7%
*-commutative80.7%
Simplified80.7%
if 4.10000000000000007e-132 < b < 600 or 1.1e7 < b Initial program 18.6%
Taylor expanded in b around inf 85.7%
associate-*r/85.7%
Simplified85.7%
Final simplification85.4%
(FPCore (a b c)
:precision binary64
(if (<= b -1.02e-96)
(+ (/ -0.6666666666666666 (/ a b)) (* 0.5 (/ c b)))
(if (or (<= b 3e-137) (and (not (<= b 1100.0)) (<= b 40000000.0)))
(/ (- (sqrt (* -3.0 (* a c))) b) (* 3.0 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.02e-96) {
tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
} else if ((b <= 3e-137) || (!(b <= 1100.0) && (b <= 40000000.0))) {
tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * 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 <= (-1.02d-96)) then
tmp = ((-0.6666666666666666d0) / (a / b)) + (0.5d0 * (c / b))
else if ((b <= 3d-137) .or. (.not. (b <= 1100.0d0)) .and. (b <= 40000000.0d0)) then
tmp = (sqrt(((-3.0d0) * (a * c))) - b) / (3.0d0 * 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 <= -1.02e-96) {
tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
} else if ((b <= 3e-137) || (!(b <= 1100.0) && (b <= 40000000.0))) {
tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.02e-96: tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b)) elif (b <= 3e-137) or (not (b <= 1100.0) and (b <= 40000000.0)): tmp = (math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.02e-96) tmp = Float64(Float64(-0.6666666666666666 / Float64(a / b)) + Float64(0.5 * Float64(c / b))); elseif ((b <= 3e-137) || (!(b <= 1100.0) && (b <= 40000000.0))) tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(3.0 * 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 <= -1.02e-96) tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b)); elseif ((b <= 3e-137) || (~((b <= 1100.0)) && (b <= 40000000.0))) tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.02e-96], N[(N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 3e-137], And[N[Not[LessEqual[b, 1100.0]], $MachinePrecision], LessEqual[b, 40000000.0]]], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.02 \cdot 10^{-96}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 3 \cdot 10^{-137} \lor \neg \left(b \leq 1100\right) \land b \leq 40000000:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.02000000000000007e-96Initial program 63.4%
Taylor expanded in b around -inf 87.8%
clear-num87.8%
un-div-inv87.9%
Applied egg-rr87.9%
if -1.02000000000000007e-96 < b < 2.9999999999999998e-137 or 1100 < b < 4e7Initial program 82.7%
Taylor expanded in b around 0 80.7%
if 2.9999999999999998e-137 < b < 1100 or 4e7 < b Initial program 18.6%
Taylor expanded in b around inf 85.7%
associate-*r/85.7%
Simplified85.7%
Final simplification85.4%
(FPCore (a b c)
:precision binary64
(if (<= b -1.02e-96)
(+ (/ -0.6666666666666666 (/ a b)) (* 0.5 (/ c b)))
(if (<= b 1.6e-133)
(/ (- (sqrt (* c (* a -3.0))) b) (* 3.0 a))
(if (or (<= b 1100.0) (not (<= b 11000000.0)))
(/ (* c -0.5) b)
(/ (- (sqrt (* -3.0 (* a c))) b) (* 3.0 a))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.02e-96) {
tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
} else if (b <= 1.6e-133) {
tmp = (sqrt((c * (a * -3.0))) - b) / (3.0 * a);
} else if ((b <= 1100.0) || !(b <= 11000000.0)) {
tmp = (c * -0.5) / b;
} else {
tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
}
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.02d-96)) then
tmp = ((-0.6666666666666666d0) / (a / b)) + (0.5d0 * (c / b))
else if (b <= 1.6d-133) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (3.0d0 * a)
else if ((b <= 1100.0d0) .or. (.not. (b <= 11000000.0d0))) then
tmp = (c * (-0.5d0)) / b
else
tmp = (sqrt(((-3.0d0) * (a * c))) - b) / (3.0d0 * a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.02e-96) {
tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
} else if (b <= 1.6e-133) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (3.0 * a);
} else if ((b <= 1100.0) || !(b <= 11000000.0)) {
tmp = (c * -0.5) / b;
} else {
tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.02e-96: tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b)) elif b <= 1.6e-133: tmp = (math.sqrt((c * (a * -3.0))) - b) / (3.0 * a) elif (b <= 1100.0) or not (b <= 11000000.0): tmp = (c * -0.5) / b else: tmp = (math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.02e-96) tmp = Float64(Float64(-0.6666666666666666 / Float64(a / b)) + Float64(0.5 * Float64(c / b))); elseif (b <= 1.6e-133) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(3.0 * a)); elseif ((b <= 1100.0) || !(b <= 11000000.0)) tmp = Float64(Float64(c * -0.5) / b); else tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(3.0 * a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.02e-96) tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b)); elseif (b <= 1.6e-133) tmp = (sqrt((c * (a * -3.0))) - b) / (3.0 * a); elseif ((b <= 1100.0) || ~((b <= 11000000.0))) tmp = (c * -0.5) / b; else tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.02e-96], N[(N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.6e-133], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1100.0], N[Not[LessEqual[b, 11000000.0]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.02 \cdot 10^{-96}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.6 \cdot 10^{-133}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 11000000\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\
\end{array}
\end{array}
if b < -1.02000000000000007e-96Initial program 63.4%
Taylor expanded in b around -inf 87.8%
clear-num87.8%
un-div-inv87.9%
Applied egg-rr87.9%
if -1.02000000000000007e-96 < b < 1.60000000000000006e-133Initial program 81.1%
Taylor expanded in b around 0 78.9%
associate-*r*79.0%
*-commutative79.0%
*-commutative79.0%
Simplified79.0%
if 1.60000000000000006e-133 < b < 1100 or 1.1e7 < b Initial program 18.6%
Taylor expanded in b around inf 85.7%
associate-*r/85.7%
Simplified85.7%
if 1100 < b < 1.1e7Initial program 99.4%
Taylor expanded in b around 0 99.7%
Final simplification85.4%
(FPCore (a b c)
:precision binary64
(if (<= b -1.6e+161)
(/ (* b -2.0) (* 3.0 a))
(if (<= b 5.2e-130)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
(if (or (<= b 1100.0) (not (<= b 21000000.0)))
(/ (* c -0.5) b)
(/ (- (sqrt (* -3.0 (* a c))) b) (* 3.0 a))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.6e+161) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 5.2e-130) {
tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
} else if ((b <= 1100.0) || !(b <= 21000000.0)) {
tmp = (c * -0.5) / b;
} else {
tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
}
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.6d+161)) then
tmp = (b * (-2.0d0)) / (3.0d0 * a)
else if (b <= 5.2d-130) then
tmp = (sqrt(((b * b) - ((3.0d0 * a) * c))) - b) / (3.0d0 * a)
else if ((b <= 1100.0d0) .or. (.not. (b <= 21000000.0d0))) then
tmp = (c * (-0.5d0)) / b
else
tmp = (sqrt(((-3.0d0) * (a * c))) - b) / (3.0d0 * a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.6e+161) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 5.2e-130) {
tmp = (Math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
} else if ((b <= 1100.0) || !(b <= 21000000.0)) {
tmp = (c * -0.5) / b;
} else {
tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.6e+161: tmp = (b * -2.0) / (3.0 * a) elif b <= 5.2e-130: tmp = (math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a) elif (b <= 1100.0) or not (b <= 21000000.0): tmp = (c * -0.5) / b else: tmp = (math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.6e+161) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a)); elseif (b <= 5.2e-130) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)); elseif ((b <= 1100.0) || !(b <= 21000000.0)) tmp = Float64(Float64(c * -0.5) / b); else tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(3.0 * a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.6e+161) tmp = (b * -2.0) / (3.0 * a); elseif (b <= 5.2e-130) tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a); elseif ((b <= 1100.0) || ~((b <= 21000000.0))) tmp = (c * -0.5) / b; else tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.6e+161], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.2e-130], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1100.0], N[Not[LessEqual[b, 21000000.0]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.6 \cdot 10^{+161}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq 5.2 \cdot 10^{-130}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 21000000\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\
\end{array}
\end{array}
if b < -1.60000000000000001e161Initial program 23.9%
Taylor expanded in b around -inf 95.3%
*-commutative95.3%
Simplified95.3%
if -1.60000000000000001e161 < b < 5.2000000000000001e-130Initial program 86.3%
if 5.2000000000000001e-130 < b < 1100 or 2.1e7 < b Initial program 18.6%
Taylor expanded in b around inf 85.7%
associate-*r/85.7%
Simplified85.7%
if 1100 < b < 2.1e7Initial program 99.4%
Taylor expanded in b around 0 99.7%
Final simplification87.7%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (+ (* 0.5 (/ c b)) (* -0.6666666666666666 (/ b a))) (/ (* c -0.5) b)))
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 * -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-310)) then
tmp = (0.5d0 * (c / b)) + ((-0.6666666666666666d0) * (b / 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 <= -5e-310) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else {
tmp = (c * -0.5) / b;
}
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 * -0.5) / b 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 * -0.5) / b); 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 * -0.5) / b; 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 * -0.5), $MachinePrecision] / b), $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 \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 67.6%
Taylor expanded in b around -inf 69.6%
if -4.999999999999985e-310 < b Initial program 32.6%
Taylor expanded in b around inf 69.4%
associate-*r/69.4%
Simplified69.4%
Final simplification69.5%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (+ (/ -0.6666666666666666 (/ a b)) (* 0.5 (/ c b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (-0.6666666666666666 / (a / b)) + (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-310)) then
tmp = ((-0.6666666666666666d0) / (a / b)) + (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-310) {
tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(-0.6666666666666666 / Float64(a / b)) + 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-310) tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $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^{-310}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 67.6%
Taylor expanded in b around -inf 69.6%
clear-num69.6%
un-div-inv69.7%
Applied egg-rr69.7%
if -4.999999999999985e-310 < b Initial program 32.6%
Taylor expanded in b around inf 69.4%
associate-*r/69.4%
Simplified69.4%
Final simplification69.6%
(FPCore (a b c) :precision binary64 (if (<= b 1.5e-298) (/ (* b -2.0) (* 3.0 a)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.5e-298) {
tmp = (b * -2.0) / (3.0 * 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 <= 1.5d-298) then
tmp = (b * (-2.0d0)) / (3.0d0 * 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 <= 1.5e-298) {
tmp = (b * -2.0) / (3.0 * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.5e-298: tmp = (b * -2.0) / (3.0 * a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.5e-298) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * 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 <= 1.5e-298) tmp = (b * -2.0) / (3.0 * a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.5e-298], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.5 \cdot 10^{-298}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.5e-298Initial program 67.0%
Taylor expanded in b around -inf 68.7%
*-commutative68.7%
Simplified68.7%
if 1.5e-298 < b Initial program 32.9%
Taylor expanded in b around inf 70.0%
associate-*r/70.0%
Simplified70.0%
Final simplification69.3%
(FPCore (a b c) :precision binary64 (if (<= b 5.8e-293) (/ (/ (* b -2.0) 3.0) a) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.8e-293) {
tmp = ((b * -2.0) / 3.0) / 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 <= 5.8d-293) then
tmp = ((b * (-2.0d0)) / 3.0d0) / 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 <= 5.8e-293) {
tmp = ((b * -2.0) / 3.0) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.8e-293: tmp = ((b * -2.0) / 3.0) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.8e-293) tmp = Float64(Float64(Float64(b * -2.0) / 3.0) / 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 <= 5.8e-293) tmp = ((b * -2.0) / 3.0) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.8e-293], N[(N[(N[(b * -2.0), $MachinePrecision] / 3.0), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.8 \cdot 10^{-293}:\\
\;\;\;\;\frac{\frac{b \cdot -2}{3}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 5.7999999999999999e-293Initial program 67.0%
Taylor expanded in b around -inf 68.7%
*-commutative68.7%
Simplified68.7%
add-cube-cbrt67.8%
*-commutative67.8%
times-frac67.7%
pow267.7%
Applied egg-rr67.7%
associate-*l/67.7%
associate-*r/67.7%
unpow267.7%
rem-3cbrt-lft68.7%
Simplified68.7%
if 5.7999999999999999e-293 < b Initial program 32.9%
Taylor expanded in b around inf 70.0%
associate-*r/70.0%
Simplified70.0%
Final simplification69.3%
(FPCore (a b c) :precision binary64 (if (<= b 0.006) (* b (/ -0.6666666666666666 a)) (* 0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 0.006) {
tmp = b * (-0.6666666666666666 / 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 <= 0.006d0) then
tmp = b * ((-0.6666666666666666d0) / 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 <= 0.006) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = 0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 0.006: tmp = b * (-0.6666666666666666 / a) else: tmp = 0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 0.006) tmp = Float64(b * Float64(-0.6666666666666666 / 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 <= 0.006) tmp = b * (-0.6666666666666666 / a); else tmp = 0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 0.006], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.006:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 0.0060000000000000001Initial program 65.1%
Taylor expanded in b around -inf 51.7%
*-commutative51.7%
Simplified51.7%
Taylor expanded in b around 0 51.5%
*-commutative51.5%
associate-*l/51.6%
associate-*r/51.6%
Simplified51.6%
if 0.0060000000000000001 < b Initial program 18.3%
Taylor expanded in b around -inf 2.6%
Taylor expanded in b around 0 25.5%
Final simplification43.2%
(FPCore (a b c) :precision binary64 (if (<= b 2.8e-302) (* b (/ -0.6666666666666666 a)) (/ -0.5 (/ b c))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.8e-302) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = -0.5 / (b / c);
}
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.8d-302) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = (-0.5d0) / (b / c)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2.8e-302) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = -0.5 / (b / c);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.8e-302: tmp = b * (-0.6666666666666666 / a) else: tmp = -0.5 / (b / c) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.8e-302) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(-0.5 / Float64(b / c)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2.8e-302) tmp = b * (-0.6666666666666666 / a); else tmp = -0.5 / (b / c); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.8e-302], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.8 \cdot 10^{-302}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{\frac{b}{c}}\\
\end{array}
\end{array}
if b < 2.8e-302Initial program 67.0%
Taylor expanded in b around -inf 68.7%
*-commutative68.7%
Simplified68.7%
Taylor expanded in b around 0 68.5%
*-commutative68.5%
associate-*l/68.6%
associate-*r/68.6%
Simplified68.6%
if 2.8e-302 < b Initial program 32.9%
Taylor expanded in b around inf 70.0%
associate-*r/70.0%
associate-/l*69.7%
Simplified69.7%
Final simplification69.1%
(FPCore (a b c) :precision binary64 (if (<= b 2.8e-302) (* b (/ -0.6666666666666666 a)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.8e-302) {
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 <= 2.8d-302) 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 <= 2.8e-302) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.8e-302: tmp = b * (-0.6666666666666666 / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.8e-302) tmp = Float64(b * Float64(-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 <= 2.8e-302) tmp = b * (-0.6666666666666666 / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.8e-302], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.8 \cdot 10^{-302}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 2.8e-302Initial program 67.0%
Taylor expanded in b around -inf 68.7%
*-commutative68.7%
Simplified68.7%
Taylor expanded in b around 0 68.5%
*-commutative68.5%
associate-*l/68.6%
associate-*r/68.6%
Simplified68.6%
if 2.8e-302 < b Initial program 32.9%
Taylor expanded in b around inf 70.0%
associate-*r/70.0%
Simplified70.0%
Final simplification69.3%
(FPCore (a b c) :precision binary64 (if (<= b 2.5e-301) (/ (* b -0.6666666666666666) a) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.5e-301) {
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 <= 2.5d-301) 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 <= 2.5e-301) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.5e-301: tmp = (b * -0.6666666666666666) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.5e-301) 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 <= 2.5e-301) tmp = (b * -0.6666666666666666) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.5e-301], 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.5 \cdot 10^{-301}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 2.50000000000000006e-301Initial program 67.0%
Taylor expanded in b around -inf 68.5%
*-commutative68.5%
Simplified68.5%
associate-*l/68.6%
Applied egg-rr68.6%
if 2.50000000000000006e-301 < b Initial program 32.9%
Taylor expanded in b around inf 70.0%
associate-*r/70.0%
Simplified70.0%
Final simplification69.3%
(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 50.1%
Taylor expanded in b around -inf 36.0%
Taylor expanded in b around 0 10.3%
Final simplification10.3%
herbie shell --seed 2024040
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))