
(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 13 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 -1e+153)
(/ (* b -0.6666666666666666) a)
(if (<= b 6.6)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e+153) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 6.6) {
tmp = (sqrt(((b * b) - ((a * 3.0) * 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 <= (-1d+153)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 6.6d0) then
tmp = (sqrt(((b * b) - ((a * 3.0d0) * 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 <= -1e+153) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 6.6) {
tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e+153: tmp = (b * -0.6666666666666666) / a elif b <= 6.6: tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e+153) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 6.6) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * 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 <= -1e+153) tmp = (b * -0.6666666666666666) / a; elseif (b <= 6.6) tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e+153], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 6.6], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 3.0), $MachinePrecision] * 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 -1 \cdot 10^{+153}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 6.6:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1e153Initial program 41.7%
Simplified41.7%
Taylor expanded in b around 0 41.7%
*-commutative41.7%
fma-define41.7%
Simplified41.7%
Taylor expanded in b around -inf 94.5%
associate-*r/94.5%
Simplified94.5%
if -1e153 < b < 6.5999999999999996Initial program 83.5%
if 6.5999999999999996 < b Initial program 8.7%
Simplified8.7%
Taylor expanded in b around inf 91.5%
Final simplification87.4%
(FPCore (a b c)
:precision binary64
(if (<= b -7.5e+153)
(/ (* b -0.6666666666666666) a)
(if (<= b 6.6)
(/ (- (sqrt (- (* b b) (* a (* 3.0 c)))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.5e+153) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 6.6) {
tmp = (sqrt(((b * b) - (a * (3.0 * 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 <= (-7.5d+153)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 6.6d0) then
tmp = (sqrt(((b * b) - (a * (3.0d0 * 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 <= -7.5e+153) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 6.6) {
tmp = (Math.sqrt(((b * b) - (a * (3.0 * c)))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7.5e+153: tmp = (b * -0.6666666666666666) / a elif b <= 6.6: tmp = (math.sqrt(((b * b) - (a * (3.0 * c)))) - b) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7.5e+153) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 6.6) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(a * Float64(3.0 * 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 <= -7.5e+153) tmp = (b * -0.6666666666666666) / a; elseif (b <= 6.6) tmp = (sqrt(((b * b) - (a * (3.0 * c)))) - b) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7.5e+153], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 6.6], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(a * N[(3.0 * c), $MachinePrecision]), $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 -7.5 \cdot 10^{+153}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 6.6:\\
\;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -7.50000000000000065e153Initial program 41.7%
Simplified41.7%
Taylor expanded in b around 0 41.7%
*-commutative41.7%
fma-define41.7%
Simplified41.7%
Taylor expanded in b around -inf 94.5%
associate-*r/94.5%
Simplified94.5%
if -7.50000000000000065e153 < b < 6.5999999999999996Initial program 83.5%
add-sqr-sqrt51.4%
pow251.4%
Applied egg-rr51.4%
Taylor expanded in a around 0 83.3%
unpow283.3%
rem-square-sqrt83.5%
Simplified83.5%
if 6.5999999999999996 < b Initial program 8.7%
Simplified8.7%
Taylor expanded in b around inf 91.5%
Final simplification87.4%
(FPCore (a b c)
:precision binary64
(if (<= b -7e+153)
(/ (* b -0.6666666666666666) a)
(if (<= b 80.0)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7e+153) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 80.0) {
tmp = (sqrt(((b * b) - (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 <= (-7d+153)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 80.0d0) then
tmp = (sqrt(((b * b) - (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 <= -7e+153) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 80.0) {
tmp = (Math.sqrt(((b * b) - (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 <= -7e+153: tmp = (b * -0.6666666666666666) / a elif b <= 80.0: tmp = (math.sqrt(((b * b) - (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 <= -7e+153) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 80.0) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - 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 <= -7e+153) tmp = (b * -0.6666666666666666) / a; elseif (b <= 80.0) tmp = (sqrt(((b * b) - (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, -7e+153], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 80.0], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $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 -7 \cdot 10^{+153}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 80:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 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 < -6.9999999999999998e153Initial program 41.7%
Simplified41.7%
Taylor expanded in b around 0 41.7%
*-commutative41.7%
fma-define41.7%
Simplified41.7%
Taylor expanded in b around -inf 94.5%
associate-*r/94.5%
Simplified94.5%
if -6.9999999999999998e153 < b < 80Initial program 83.5%
sqr-neg83.5%
sqr-neg83.5%
associate-*l*83.4%
Simplified83.4%
if 80 < b Initial program 8.7%
Simplified8.7%
Taylor expanded in b around inf 91.5%
Final simplification87.4%
(FPCore (a b c)
:precision binary64
(if (<= b -2.9e-87)
(fma 0.16666666666666666 (* 3.0 (/ c b)) (* -0.6666666666666666 (/ b a)))
(if (<= b 85000.0)
(/ 1.0 (/ (* a 3.0) (- (sqrt (* c (* a -3.0))) b)))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.9e-87) {
tmp = fma(0.16666666666666666, (3.0 * (c / b)), (-0.6666666666666666 * (b / a)));
} else if (b <= 85000.0) {
tmp = 1.0 / ((a * 3.0) / (sqrt((c * (a * -3.0))) - b));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.9e-87) tmp = fma(0.16666666666666666, Float64(3.0 * Float64(c / b)), Float64(-0.6666666666666666 * Float64(b / a))); elseif (b <= 85000.0) tmp = Float64(1.0 / Float64(Float64(a * 3.0) / Float64(sqrt(Float64(c * Float64(a * -3.0))) - b))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.9e-87], N[(0.16666666666666666 * N[(3.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 85000.0], N[(1.0 / N[(N[(a * 3.0), $MachinePrecision] / N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.9 \cdot 10^{-87}:\\
\;\;\;\;\mathsf{fma}\left(0.16666666666666666, 3 \cdot \frac{c}{b}, -0.6666666666666666 \cdot \frac{b}{a}\right)\\
\mathbf{elif}\;b \leq 85000:\\
\;\;\;\;\frac{1}{\frac{a \cdot 3}{\sqrt{c \cdot \left(a \cdot -3\right)} - b}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -2.8999999999999999e-87Initial program 75.0%
add-sqr-sqrt43.6%
pow243.6%
Applied egg-rr43.6%
Taylor expanded in b around -inf 82.9%
Taylor expanded in c around 0 83.0%
+-commutative83.0%
fma-define83.0%
*-commutative83.0%
unpow283.0%
rem-square-sqrt83.0%
*-lft-identity83.0%
times-frac83.0%
metadata-eval83.0%
*-commutative83.0%
Simplified83.0%
if -2.8999999999999999e-87 < b < 85000Initial program 75.4%
Simplified75.3%
Taylor expanded in b around 0 70.0%
associate-*r*70.1%
sqrt-prod34.1%
metadata-eval34.1%
distribute-lft-neg-in34.1%
*-commutative34.1%
distribute-rgt-neg-in34.1%
metadata-eval34.1%
Applied egg-rr34.1%
clear-num34.1%
inv-pow34.1%
metadata-eval34.1%
metadata-eval34.1%
sqrt-pow233.8%
*-commutative33.8%
sqrt-pow234.1%
metadata-eval34.1%
metadata-eval34.1%
sqrt-unprod70.1%
Applied egg-rr70.1%
unpow-170.1%
associate-/l*69.9%
associate-*l*70.0%
Simplified70.0%
associate-*r/70.1%
associate-*r*70.1%
*-commutative70.1%
Applied egg-rr70.1%
if 85000 < b Initial program 8.7%
Simplified8.7%
Taylor expanded in b around inf 91.5%
Final simplification81.7%
(FPCore (a b c)
:precision binary64
(if (<= b -4.8e-85)
(fma 0.16666666666666666 (* 3.0 (/ c b)) (* -0.6666666666666666 (/ b a)))
(if (<= b 1250000000.0)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.8e-85) {
tmp = fma(0.16666666666666666, (3.0 * (c / b)), (-0.6666666666666666 * (b / a)));
} else if (b <= 1250000000.0) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -4.8e-85) tmp = fma(0.16666666666666666, Float64(3.0 * Float64(c / b)), Float64(-0.6666666666666666 * Float64(b / a))); elseif (b <= 1250000000.0) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -4.8e-85], N[(0.16666666666666666 * N[(3.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1250000000.0], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $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 -4.8 \cdot 10^{-85}:\\
\;\;\;\;\mathsf{fma}\left(0.16666666666666666, 3 \cdot \frac{c}{b}, -0.6666666666666666 \cdot \frac{b}{a}\right)\\
\mathbf{elif}\;b \leq 1250000000:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -4.8000000000000001e-85Initial program 75.0%
add-sqr-sqrt43.6%
pow243.6%
Applied egg-rr43.6%
Taylor expanded in b around -inf 82.9%
Taylor expanded in c around 0 83.0%
+-commutative83.0%
fma-define83.0%
*-commutative83.0%
unpow283.0%
rem-square-sqrt83.0%
*-lft-identity83.0%
times-frac83.0%
metadata-eval83.0%
*-commutative83.0%
Simplified83.0%
if -4.8000000000000001e-85 < b < 1.25e9Initial program 75.4%
Simplified75.3%
Taylor expanded in b around 0 70.0%
associate-*r*70.1%
*-commutative70.1%
Simplified70.1%
if 1.25e9 < b Initial program 8.7%
Simplified8.7%
Taylor expanded in b around inf 91.5%
Final simplification81.7%
(FPCore (a b c)
:precision binary64
(if (<= b -3.8e-85)
(*
b
(-
(* 0.6666666666666666 (/ -1.0 a))
(* -0.16666666666666666 (/ (* 3.0 (/ c b)) b))))
(if (<= b 6.6)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.8e-85) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b)));
} else if (b <= 6.6) {
tmp = (sqrt((c * (a * -3.0))) - 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-85)) then
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.16666666666666666d0) * ((3.0d0 * (c / b)) / b)))
else if (b <= 6.6d0) then
tmp = (sqrt((c * (a * (-3.0d0)))) - 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-85) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b)));
} else if (b <= 6.6) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.8e-85: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b))) elif b <= 6.6: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.8e-85) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.16666666666666666 * Float64(Float64(3.0 * Float64(c / b)) / b)))); elseif (b <= 6.6) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - 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-85) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b))); elseif (b <= 6.6) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.8e-85], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.16666666666666666 * N[(N[(3.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.6], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $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^{-85}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.16666666666666666 \cdot \frac{3 \cdot \frac{c}{b}}{b}\right)\\
\mathbf{elif}\;b \leq 6.6:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -3.7999999999999999e-85Initial program 75.0%
add-sqr-sqrt43.6%
pow243.6%
Applied egg-rr43.6%
Taylor expanded in b around -inf 82.9%
pow282.9%
add-sqr-sqrt64.4%
sqrt-div41.3%
sqrt-pow241.3%
metadata-eval41.3%
metadata-eval41.3%
sqrt-prod0.0%
add-sqr-sqrt40.8%
sqrt-div40.8%
sqrt-pow240.8%
metadata-eval40.8%
metadata-eval40.8%
sqrt-prod0.0%
add-sqr-sqrt41.3%
Applied egg-rr41.3%
associate-*l/41.3%
associate-*r/41.3%
rem-square-sqrt82.9%
*-commutative82.9%
*-lft-identity82.9%
times-frac82.9%
metadata-eval82.9%
Simplified82.9%
if -3.7999999999999999e-85 < b < 6.5999999999999996Initial program 75.4%
Simplified75.3%
Taylor expanded in b around 0 70.0%
associate-*r*70.1%
*-commutative70.1%
Simplified70.1%
if 6.5999999999999996 < b Initial program 8.7%
Simplified8.7%
Taylor expanded in b around inf 91.5%
Final simplification81.7%
(FPCore (a b c)
:precision binary64
(if (<= b -5.1e-86)
(*
b
(-
(* 0.6666666666666666 (/ -1.0 a))
(* -0.16666666666666666 (/ (* 3.0 (/ c b)) b))))
(if (<= b 6.6)
(/ (- (sqrt (* (* a c) -3.0)) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.1e-86) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b)));
} else if (b <= 6.6) {
tmp = (sqrt(((a * c) * -3.0)) - 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 <= (-5.1d-86)) then
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.16666666666666666d0) * ((3.0d0 * (c / b)) / b)))
else if (b <= 6.6d0) then
tmp = (sqrt(((a * c) * (-3.0d0))) - 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 <= -5.1e-86) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b)));
} else if (b <= 6.6) {
tmp = (Math.sqrt(((a * c) * -3.0)) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.1e-86: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b))) elif b <= 6.6: tmp = (math.sqrt(((a * c) * -3.0)) - b) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.1e-86) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.16666666666666666 * Float64(Float64(3.0 * Float64(c / b)) / b)))); elseif (b <= 6.6) tmp = Float64(Float64(sqrt(Float64(Float64(a * c) * -3.0)) - 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 <= -5.1e-86) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b))); elseif (b <= 6.6) tmp = (sqrt(((a * c) * -3.0)) - b) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.1e-86], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.16666666666666666 * N[(N[(3.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.6], N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $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 -5.1 \cdot 10^{-86}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.16666666666666666 \cdot \frac{3 \cdot \frac{c}{b}}{b}\right)\\
\mathbf{elif}\;b \leq 6.6:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -5.10000000000000006e-86Initial program 75.0%
add-sqr-sqrt43.6%
pow243.6%
Applied egg-rr43.6%
Taylor expanded in b around -inf 82.9%
pow282.9%
add-sqr-sqrt64.4%
sqrt-div41.3%
sqrt-pow241.3%
metadata-eval41.3%
metadata-eval41.3%
sqrt-prod0.0%
add-sqr-sqrt40.8%
sqrt-div40.8%
sqrt-pow240.8%
metadata-eval40.8%
metadata-eval40.8%
sqrt-prod0.0%
add-sqr-sqrt41.3%
Applied egg-rr41.3%
associate-*l/41.3%
associate-*r/41.3%
rem-square-sqrt82.9%
*-commutative82.9%
*-lft-identity82.9%
times-frac82.9%
metadata-eval82.9%
Simplified82.9%
if -5.10000000000000006e-86 < b < 6.5999999999999996Initial program 75.4%
Simplified75.3%
Taylor expanded in b around 0 70.0%
if 6.5999999999999996 < b Initial program 8.7%
Simplified8.7%
Taylor expanded in b around inf 91.5%
Final simplification81.6%
(FPCore (a b c)
:precision binary64
(if (<= b -5.3e-89)
(*
b
(-
(* 0.6666666666666666 (/ -1.0 a))
(* -0.16666666666666666 (/ (* 3.0 (/ c b)) b))))
(if (<= b 12.0)
(* 0.3333333333333333 (/ (- (sqrt (* a (* c -3.0))) b) a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.3e-89) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b)));
} else if (b <= 12.0) {
tmp = 0.3333333333333333 * ((sqrt((a * (c * -3.0))) - 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 <= (-5.3d-89)) then
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.16666666666666666d0) * ((3.0d0 * (c / b)) / b)))
else if (b <= 12.0d0) then
tmp = 0.3333333333333333d0 * ((sqrt((a * (c * (-3.0d0)))) - 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 <= -5.3e-89) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b)));
} else if (b <= 12.0) {
tmp = 0.3333333333333333 * ((Math.sqrt((a * (c * -3.0))) - b) / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.3e-89: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b))) elif b <= 12.0: tmp = 0.3333333333333333 * ((math.sqrt((a * (c * -3.0))) - b) / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.3e-89) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.16666666666666666 * Float64(Float64(3.0 * Float64(c / b)) / b)))); elseif (b <= 12.0) tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - 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 <= -5.3e-89) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b))); elseif (b <= 12.0) tmp = 0.3333333333333333 * ((sqrt((a * (c * -3.0))) - b) / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.3e-89], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.16666666666666666 * N[(N[(3.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 12.0], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.3 \cdot 10^{-89}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.16666666666666666 \cdot \frac{3 \cdot \frac{c}{b}}{b}\right)\\
\mathbf{elif}\;b \leq 12:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -5.3000000000000001e-89Initial program 75.0%
add-sqr-sqrt43.6%
pow243.6%
Applied egg-rr43.6%
Taylor expanded in b around -inf 82.9%
pow282.9%
add-sqr-sqrt64.4%
sqrt-div41.3%
sqrt-pow241.3%
metadata-eval41.3%
metadata-eval41.3%
sqrt-prod0.0%
add-sqr-sqrt40.8%
sqrt-div40.8%
sqrt-pow240.8%
metadata-eval40.8%
metadata-eval40.8%
sqrt-prod0.0%
add-sqr-sqrt41.3%
Applied egg-rr41.3%
associate-*l/41.3%
associate-*r/41.3%
rem-square-sqrt82.9%
*-commutative82.9%
*-lft-identity82.9%
times-frac82.9%
metadata-eval82.9%
Simplified82.9%
if -5.3000000000000001e-89 < b < 12Initial program 75.4%
Simplified75.3%
Taylor expanded in b around 0 70.0%
associate-*r*70.1%
sqrt-prod34.1%
metadata-eval34.1%
distribute-lft-neg-in34.1%
*-commutative34.1%
distribute-rgt-neg-in34.1%
metadata-eval34.1%
Applied egg-rr34.1%
div-sub34.1%
sqrt-unprod70.1%
metadata-eval70.1%
metadata-eval70.1%
sqrt-pow269.5%
*-commutative69.5%
sqrt-pow270.1%
metadata-eval70.1%
metadata-eval70.1%
metadata-eval70.1%
metadata-eval70.1%
sqrt-pow270.1%
*-commutative70.1%
sqrt-pow270.1%
metadata-eval70.1%
metadata-eval70.1%
Applied egg-rr70.1%
div-sub70.1%
*-lft-identity70.1%
*-commutative70.1%
times-frac69.9%
metadata-eval69.9%
associate-*l*70.0%
Simplified70.0%
if 12 < b Initial program 8.7%
Simplified8.7%
Taylor expanded in b around inf 91.5%
Final simplification81.6%
(FPCore (a b c)
:precision binary64
(if (<= b -1e-310)
(*
b
(-
(* 0.6666666666666666 (/ -1.0 a))
(* -0.16666666666666666 (/ (* 3.0 (/ c b)) b))))
(* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / 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-310)) then
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.16666666666666666d0) * ((3.0d0 * (c / b)) / 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-310) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b)));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b))) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.16666666666666666 * Float64(Float64(3.0 * Float64(c / b)) / 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-310) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.16666666666666666 * ((3.0 * (c / b)) / b))); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.16666666666666666 * N[(N[(3.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.16666666666666666 \cdot \frac{3 \cdot \frac{c}{b}}{b}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 78.6%
add-sqr-sqrt46.8%
pow246.8%
Applied egg-rr46.8%
Taylor expanded in b around -inf 69.6%
pow269.6%
add-sqr-sqrt52.2%
sqrt-div33.8%
sqrt-pow233.8%
metadata-eval33.8%
metadata-eval33.8%
sqrt-prod0.0%
add-sqr-sqrt33.2%
sqrt-div33.2%
sqrt-pow233.2%
metadata-eval33.2%
metadata-eval33.2%
sqrt-prod0.0%
add-sqr-sqrt33.8%
Applied egg-rr33.8%
associate-*l/33.8%
associate-*r/33.8%
rem-square-sqrt69.7%
*-commutative69.7%
*-lft-identity69.7%
times-frac69.7%
metadata-eval69.7%
Simplified69.7%
if -9.999999999999969e-311 < b Initial program 31.1%
Simplified31.1%
Taylor expanded in b around inf 65.3%
Final simplification67.6%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (/ (* b -2.0) (* a 3.0)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
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-310)) 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-310) {
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-310: 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-310) 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-310) 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-310], 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^{-310}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 78.6%
Simplified78.5%
Taylor expanded in b around -inf 69.3%
*-commutative69.3%
Simplified69.3%
if -9.999999999999969e-311 < b Initial program 31.1%
Simplified31.1%
Taylor expanded in b around inf 65.3%
Final simplification67.4%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (/ (* b -0.6666666666666666) a) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
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 <= (-1d-310)) 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 <= -1e-310) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = (b * -0.6666666666666666) / a else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) tmp = Float64(Float64(b * -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 <= -1e-310) tmp = (b * -0.6666666666666666) / a; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 78.6%
Simplified78.5%
Taylor expanded in b around 0 78.5%
*-commutative78.5%
fma-define78.5%
Simplified78.5%
Taylor expanded in b around -inf 69.2%
associate-*r/69.3%
Simplified69.3%
if -9.999999999999969e-311 < b Initial program 31.1%
Simplified31.1%
Taylor expanded in b around inf 65.3%
Final simplification67.4%
(FPCore (a b c) :precision binary64 (if (<= b 1.58e-298) (* b (/ -0.6666666666666666 a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.58e-298) {
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 <= 1.58d-298) 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 <= 1.58e-298) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.58e-298: tmp = b * (-0.6666666666666666 / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.58e-298) 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 <= 1.58e-298) tmp = b * (-0.6666666666666666 / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.58e-298], 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 1.58 \cdot 10^{-298}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 1.5800000000000001e-298Initial program 78.6%
Simplified78.5%
Taylor expanded in b around -inf 69.2%
*-commutative69.2%
Simplified69.2%
Taylor expanded in b around 0 69.2%
*-commutative69.2%
associate-*l/69.3%
associate-/l*69.3%
Simplified69.3%
if 1.5800000000000001e-298 < b Initial program 31.1%
Simplified31.1%
Taylor expanded in b around inf 65.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 55.4%
Simplified55.4%
Taylor expanded in b around inf 32.9%
herbie shell --seed 2024123
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))