
(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 -1.56e+152)
(* (/ b (- 3.0)) (/ (fma (* -1.5 a) (* c (pow b -2.0)) 2.0) a))
(if (<= b 2.02e-66)
(/ (- (sqrt (- (* b b) (* c (* 3.0 a)))) b) (* 3.0 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.56e+152) {
tmp = (b / -3.0) * (fma((-1.5 * a), (c * pow(b, -2.0)), 2.0) / a);
} else if (b <= 2.02e-66) {
tmp = (sqrt(((b * b) - (c * (3.0 * a)))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -1.56e+152) tmp = Float64(Float64(b / Float64(-3.0)) * Float64(fma(Float64(-1.5 * a), Float64(c * (b ^ -2.0)), 2.0) / a)); elseif (b <= 2.02e-66) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(3.0 * a)))) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -1.56e+152], N[(N[(b / (-3.0)), $MachinePrecision] * N[(N[(N[(-1.5 * a), $MachinePrecision] * N[(c * N[Power[b, -2.0], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.02e-66], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.56 \cdot 10^{+152}:\\
\;\;\;\;\frac{b}{-3} \cdot \frac{\mathsf{fma}\left(-1.5 \cdot a, c \cdot {b}^{-2}, 2\right)}{a}\\
\mathbf{elif}\;b \leq 2.02 \cdot 10^{-66}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.5599999999999999e152Initial program 39.2%
sqr-neg39.2%
sqr-neg39.2%
associate-*l*39.2%
Simplified39.2%
Taylor expanded in b around -inf 86.5%
associate-*r*86.5%
mul-1-neg86.5%
associate-/l*94.8%
Simplified94.8%
times-frac94.9%
+-commutative94.9%
associate-*r*94.9%
fma-define94.9%
div-inv94.9%
pow-flip94.9%
metadata-eval94.9%
Applied egg-rr94.9%
if -1.5599999999999999e152 < b < 2.0200000000000001e-66Initial program 81.9%
if 2.0200000000000001e-66 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in b around inf 87.5%
*-commutative87.5%
Simplified87.5%
Final simplification85.8%
(FPCore (a b c)
:precision binary64
(if (<= b -1.6e+150)
(/ (* b -0.6666666666666666) a)
(if (<= b 7.5e-67)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* 3.0 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.6e+150) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 7.5e-67) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.6d+150)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 7.5d-67) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (3.0d0 * a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.6e+150) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 7.5e-67) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.6e+150: tmp = (b * -0.6666666666666666) / a elif b <= 7.5e-67: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.6e+150) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 7.5e-67) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.6e+150) tmp = (b * -0.6666666666666666) / a; elseif (b <= 7.5e-67) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.6e+150], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 7.5e-67], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.6 \cdot 10^{+150}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 7.5 \cdot 10^{-67}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.60000000000000008e150Initial program 39.2%
sqr-neg39.2%
sqr-neg39.2%
associate-*l*39.2%
Simplified39.2%
Taylor expanded in b around -inf 94.8%
*-commutative94.8%
Simplified94.8%
associate-*l/94.9%
Applied egg-rr94.9%
if -1.60000000000000008e150 < b < 7.5000000000000005e-67Initial program 81.9%
sqr-neg81.9%
sqr-neg81.9%
associate-*l*81.8%
Simplified81.8%
if 7.5000000000000005e-67 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in b around inf 87.5%
*-commutative87.5%
Simplified87.5%
Final simplification85.8%
(FPCore (a b c)
:precision binary64
(if (<= b -1.26e+150)
(/ (* b -0.6666666666666666) a)
(if (<= b 2.1e-67)
(/ (- (sqrt (- (* b b) (* c (* 3.0 a)))) b) (* 3.0 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.26e+150) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 2.1e-67) {
tmp = (sqrt(((b * b) - (c * (3.0 * a)))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.26d+150)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 2.1d-67) then
tmp = (sqrt(((b * b) - (c * (3.0d0 * a)))) - b) / (3.0d0 * a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.26e+150) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 2.1e-67) {
tmp = (Math.sqrt(((b * b) - (c * (3.0 * a)))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.26e+150: tmp = (b * -0.6666666666666666) / a elif b <= 2.1e-67: tmp = (math.sqrt(((b * b) - (c * (3.0 * a)))) - b) / (3.0 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.26e+150) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 2.1e-67) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(3.0 * a)))) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.26e+150) tmp = (b * -0.6666666666666666) / a; elseif (b <= 2.1e-67) tmp = (sqrt(((b * b) - (c * (3.0 * a)))) - b) / (3.0 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.26e+150], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 2.1e-67], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.26 \cdot 10^{+150}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 2.1 \cdot 10^{-67}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.26e150Initial program 39.2%
sqr-neg39.2%
sqr-neg39.2%
associate-*l*39.2%
Simplified39.2%
Taylor expanded in b around -inf 94.8%
*-commutative94.8%
Simplified94.8%
associate-*l/94.9%
Applied egg-rr94.9%
if -1.26e150 < b < 2.1000000000000002e-67Initial program 81.9%
if 2.1000000000000002e-67 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in b around inf 87.5%
*-commutative87.5%
Simplified87.5%
Final simplification85.8%
(FPCore (a b c)
:precision binary64
(if (<= b -115000000.0)
(+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5))
(if (<= b 2.05e-66)
(/ (+ b (sqrt (* (* a c) -3.0))) (* 3.0 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -115000000.0) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 2.05e-66) {
tmp = (b + sqrt(((a * c) * -3.0))) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-115000000.0d0)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else if (b <= 2.05d-66) then
tmp = (b + sqrt(((a * c) * (-3.0d0)))) / (3.0d0 * a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -115000000.0) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 2.05e-66) {
tmp = (b + Math.sqrt(((a * c) * -3.0))) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -115000000.0: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) elif b <= 2.05e-66: tmp = (b + math.sqrt(((a * c) * -3.0))) / (3.0 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -115000000.0) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); elseif (b <= 2.05e-66) tmp = Float64(Float64(b + sqrt(Float64(Float64(a * c) * -3.0))) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -115000000.0) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); elseif (b <= 2.05e-66) tmp = (b + sqrt(((a * c) * -3.0))) / (3.0 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -115000000.0], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.05e-66], N[(N[(b + N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -115000000:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 2.05 \cdot 10^{-66}:\\
\;\;\;\;\frac{b + \sqrt{\left(a \cdot c\right) \cdot -3}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.15e8Initial program 58.1%
sqr-neg58.1%
sqr-neg58.1%
associate-*l*58.1%
Simplified58.1%
Taylor expanded in b around -inf 78.4%
associate-*r*78.4%
mul-1-neg78.4%
associate-/l*82.8%
Simplified82.8%
Taylor expanded in a around inf 83.0%
if -1.15e8 < b < 2.04999999999999999e-66Initial program 83.4%
sqr-neg83.4%
sqr-neg83.4%
associate-*l*83.3%
Simplified83.3%
Taylor expanded in b around 0 75.1%
+-commutative75.1%
*-un-lft-identity75.1%
fma-define75.1%
*-commutative75.1%
*-commutative75.1%
associate-*r*75.2%
add-sqr-sqrt38.1%
sqrt-unprod74.9%
sqr-neg74.9%
sqrt-prod37.0%
add-sqr-sqrt74.0%
Applied egg-rr74.0%
fma-undefine74.0%
*-lft-identity74.0%
associate-*r*73.9%
*-commutative73.9%
associate-*l*73.8%
Simplified73.8%
Taylor expanded in a around 0 73.9%
if 2.04999999999999999e-66 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in b around inf 87.5%
*-commutative87.5%
Simplified87.5%
Final simplification81.3%
(FPCore (a b c)
:precision binary64
(if (<= b -82000000.0)
(+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5))
(if (<= b 2.2e-66)
(/ (+ b (sqrt (* c (* a -3.0)))) (* 3.0 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -82000000.0) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 2.2e-66) {
tmp = (b + sqrt((c * (a * -3.0)))) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-82000000.0d0)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else if (b <= 2.2d-66) then
tmp = (b + sqrt((c * (a * (-3.0d0))))) / (3.0d0 * a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -82000000.0) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 2.2e-66) {
tmp = (b + Math.sqrt((c * (a * -3.0)))) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -82000000.0: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) elif b <= 2.2e-66: tmp = (b + math.sqrt((c * (a * -3.0)))) / (3.0 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -82000000.0) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); elseif (b <= 2.2e-66) tmp = Float64(Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -82000000.0) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); elseif (b <= 2.2e-66) tmp = (b + sqrt((c * (a * -3.0)))) / (3.0 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -82000000.0], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.2e-66], N[(N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -82000000:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 2.2 \cdot 10^{-66}:\\
\;\;\;\;\frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -8.2e7Initial program 58.1%
sqr-neg58.1%
sqr-neg58.1%
associate-*l*58.1%
Simplified58.1%
Taylor expanded in b around -inf 78.4%
associate-*r*78.4%
mul-1-neg78.4%
associate-/l*82.8%
Simplified82.8%
Taylor expanded in a around inf 83.0%
if -8.2e7 < b < 2.2000000000000001e-66Initial program 83.4%
sqr-neg83.4%
sqr-neg83.4%
associate-*l*83.3%
Simplified83.3%
Taylor expanded in b around 0 75.1%
+-commutative75.1%
*-un-lft-identity75.1%
fma-define75.1%
*-commutative75.1%
*-commutative75.1%
associate-*r*75.2%
add-sqr-sqrt38.1%
sqrt-unprod74.9%
sqr-neg74.9%
sqrt-prod37.0%
add-sqr-sqrt74.0%
Applied egg-rr74.0%
fma-undefine74.0%
*-lft-identity74.0%
Simplified74.0%
if 2.2000000000000001e-66 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in b around inf 87.5%
*-commutative87.5%
Simplified87.5%
Final simplification81.4%
(FPCore (a b c)
:precision binary64
(if (<= b -82000000.0)
(* b (- (/ (* c 0.5) (pow b 2.0)) (/ 0.6666666666666666 a)))
(if (<= b 5.3e-67)
(/ (+ b (sqrt (* c (* a -3.0)))) (* 3.0 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -82000000.0) {
tmp = b * (((c * 0.5) / pow(b, 2.0)) - (0.6666666666666666 / a));
} else if (b <= 5.3e-67) {
tmp = (b + sqrt((c * (a * -3.0)))) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-82000000.0d0)) then
tmp = b * (((c * 0.5d0) / (b ** 2.0d0)) - (0.6666666666666666d0 / a))
else if (b <= 5.3d-67) then
tmp = (b + sqrt((c * (a * (-3.0d0))))) / (3.0d0 * a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -82000000.0) {
tmp = b * (((c * 0.5) / Math.pow(b, 2.0)) - (0.6666666666666666 / a));
} else if (b <= 5.3e-67) {
tmp = (b + Math.sqrt((c * (a * -3.0)))) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -82000000.0: tmp = b * (((c * 0.5) / math.pow(b, 2.0)) - (0.6666666666666666 / a)) elif b <= 5.3e-67: tmp = (b + math.sqrt((c * (a * -3.0)))) / (3.0 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -82000000.0) tmp = Float64(b * Float64(Float64(Float64(c * 0.5) / (b ^ 2.0)) - Float64(0.6666666666666666 / a))); elseif (b <= 5.3e-67) tmp = Float64(Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -82000000.0) tmp = b * (((c * 0.5) / (b ^ 2.0)) - (0.6666666666666666 / a)); elseif (b <= 5.3e-67) tmp = (b + sqrt((c * (a * -3.0)))) / (3.0 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -82000000.0], N[(b * N[(N[(N[(c * 0.5), $MachinePrecision] / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] - N[(0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.3e-67], N[(N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -82000000:\\
\;\;\;\;b \cdot \left(\frac{c \cdot 0.5}{{b}^{2}} - \frac{0.6666666666666666}{a}\right)\\
\mathbf{elif}\;b \leq 5.3 \cdot 10^{-67}:\\
\;\;\;\;\frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -8.2e7Initial program 58.1%
sqr-neg58.1%
sqr-neg58.1%
associate-*l*58.1%
Simplified58.1%
Taylor expanded in b around -inf 78.4%
associate-*r*78.4%
mul-1-neg78.4%
associate-/l*82.8%
Simplified82.8%
Taylor expanded in b around inf 83.0%
associate-*r/83.0%
*-commutative83.0%
associate-*r/83.1%
metadata-eval83.1%
Simplified83.1%
if -8.2e7 < b < 5.29999999999999971e-67Initial program 83.4%
sqr-neg83.4%
sqr-neg83.4%
associate-*l*83.3%
Simplified83.3%
Taylor expanded in b around 0 75.1%
+-commutative75.1%
*-un-lft-identity75.1%
fma-define75.1%
*-commutative75.1%
*-commutative75.1%
associate-*r*75.2%
add-sqr-sqrt38.1%
sqrt-unprod74.9%
sqr-neg74.9%
sqrt-prod37.0%
add-sqr-sqrt74.0%
Applied egg-rr74.0%
fma-undefine74.0%
*-lft-identity74.0%
Simplified74.0%
if 5.29999999999999971e-67 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in b around inf 87.5%
*-commutative87.5%
Simplified87.5%
Final simplification81.4%
(FPCore (a b c)
:precision binary64
(if (<= b -1050000000.0)
(* b (- (/ (* c 0.5) (pow b 2.0)) (/ 0.6666666666666666 a)))
(if (<= b 3.2e-67)
(/ (- (sqrt (* (* a c) -3.0)) b) (* 3.0 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1050000000.0) {
tmp = b * (((c * 0.5) / pow(b, 2.0)) - (0.6666666666666666 / a));
} else if (b <= 3.2e-67) {
tmp = (sqrt(((a * c) * -3.0)) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1050000000.0d0)) then
tmp = b * (((c * 0.5d0) / (b ** 2.0d0)) - (0.6666666666666666d0 / a))
else if (b <= 3.2d-67) then
tmp = (sqrt(((a * c) * (-3.0d0))) - b) / (3.0d0 * a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1050000000.0) {
tmp = b * (((c * 0.5) / Math.pow(b, 2.0)) - (0.6666666666666666 / a));
} else if (b <= 3.2e-67) {
tmp = (Math.sqrt(((a * c) * -3.0)) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1050000000.0: tmp = b * (((c * 0.5) / math.pow(b, 2.0)) - (0.6666666666666666 / a)) elif b <= 3.2e-67: tmp = (math.sqrt(((a * c) * -3.0)) - b) / (3.0 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1050000000.0) tmp = Float64(b * Float64(Float64(Float64(c * 0.5) / (b ^ 2.0)) - Float64(0.6666666666666666 / a))); elseif (b <= 3.2e-67) tmp = Float64(Float64(sqrt(Float64(Float64(a * c) * -3.0)) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1050000000.0) tmp = b * (((c * 0.5) / (b ^ 2.0)) - (0.6666666666666666 / a)); elseif (b <= 3.2e-67) tmp = (sqrt(((a * c) * -3.0)) - b) / (3.0 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1050000000.0], N[(b * N[(N[(N[(c * 0.5), $MachinePrecision] / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] - N[(0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.2e-67], N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1050000000:\\
\;\;\;\;b \cdot \left(\frac{c \cdot 0.5}{{b}^{2}} - \frac{0.6666666666666666}{a}\right)\\
\mathbf{elif}\;b \leq 3.2 \cdot 10^{-67}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.05e9Initial program 58.1%
sqr-neg58.1%
sqr-neg58.1%
associate-*l*58.1%
Simplified58.1%
Taylor expanded in b around -inf 78.4%
associate-*r*78.4%
mul-1-neg78.4%
associate-/l*82.8%
Simplified82.8%
Taylor expanded in b around inf 83.0%
associate-*r/83.0%
*-commutative83.0%
associate-*r/83.1%
metadata-eval83.1%
Simplified83.1%
if -1.05e9 < b < 3.20000000000000021e-67Initial program 83.4%
sqr-neg83.4%
sqr-neg83.4%
associate-*l*83.3%
Simplified83.3%
Taylor expanded in b around 0 75.1%
if 3.20000000000000021e-67 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in b around inf 87.5%
*-commutative87.5%
Simplified87.5%
Final simplification81.8%
(FPCore (a b c)
:precision binary64
(if (<= b -82000000.0)
(* b (- (/ (* c 0.5) (pow b 2.0)) (/ 0.6666666666666666 a)))
(if (<= b 2.15e-66)
(/ (- (sqrt (* c (* a -3.0))) b) (* 3.0 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -82000000.0) {
tmp = b * (((c * 0.5) / pow(b, 2.0)) - (0.6666666666666666 / a));
} else if (b <= 2.15e-66) {
tmp = (sqrt((c * (a * -3.0))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-82000000.0d0)) then
tmp = b * (((c * 0.5d0) / (b ** 2.0d0)) - (0.6666666666666666d0 / a))
else if (b <= 2.15d-66) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (3.0d0 * a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -82000000.0) {
tmp = b * (((c * 0.5) / Math.pow(b, 2.0)) - (0.6666666666666666 / a));
} else if (b <= 2.15e-66) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (3.0 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -82000000.0: tmp = b * (((c * 0.5) / math.pow(b, 2.0)) - (0.6666666666666666 / a)) elif b <= 2.15e-66: tmp = (math.sqrt((c * (a * -3.0))) - b) / (3.0 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -82000000.0) tmp = Float64(b * Float64(Float64(Float64(c * 0.5) / (b ^ 2.0)) - Float64(0.6666666666666666 / a))); elseif (b <= 2.15e-66) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -82000000.0) tmp = b * (((c * 0.5) / (b ^ 2.0)) - (0.6666666666666666 / a)); elseif (b <= 2.15e-66) tmp = (sqrt((c * (a * -3.0))) - b) / (3.0 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -82000000.0], N[(b * N[(N[(N[(c * 0.5), $MachinePrecision] / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] - N[(0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.15e-66], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -82000000:\\
\;\;\;\;b \cdot \left(\frac{c \cdot 0.5}{{b}^{2}} - \frac{0.6666666666666666}{a}\right)\\
\mathbf{elif}\;b \leq 2.15 \cdot 10^{-66}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -8.2e7Initial program 58.1%
sqr-neg58.1%
sqr-neg58.1%
associate-*l*58.1%
Simplified58.1%
Taylor expanded in b around -inf 78.4%
associate-*r*78.4%
mul-1-neg78.4%
associate-/l*82.8%
Simplified82.8%
Taylor expanded in b around inf 83.0%
associate-*r/83.0%
*-commutative83.0%
associate-*r/83.1%
metadata-eval83.1%
Simplified83.1%
if -8.2e7 < b < 2.15000000000000007e-66Initial program 83.4%
sqr-neg83.4%
sqr-neg83.4%
associate-*l*83.3%
Simplified83.3%
Taylor expanded in b around 0 75.1%
*-commutative75.1%
*-commutative75.1%
associate-*r*75.2%
Simplified75.2%
if 2.15000000000000007e-66 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in b around inf 87.5%
*-commutative87.5%
Simplified87.5%
Final simplification81.8%
(FPCore (a b c) :precision binary64 (if (<= b -4e-310) (+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= -4e-310) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4d-310)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4e-310) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4e-310: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4e-310) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4e-310) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4e-310], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -3.999999999999988e-310Initial program 70.4%
sqr-neg70.4%
sqr-neg70.4%
associate-*l*70.5%
Simplified70.5%
Taylor expanded in b around -inf 55.6%
associate-*r*55.6%
mul-1-neg55.6%
associate-/l*58.4%
Simplified58.4%
Taylor expanded in a around inf 58.7%
if -3.999999999999988e-310 < b Initial program 34.2%
sqr-neg34.2%
sqr-neg34.2%
associate-*l*34.2%
Simplified34.2%
Taylor expanded in b around inf 64.4%
*-commutative64.4%
Simplified64.4%
Final simplification61.7%
(FPCore (a b c) :precision binary64 (if (<= b -4e-310) (* b (/ -0.6666666666666666 a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4e-310) {
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 <= (-4d-310)) 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 <= -4e-310) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4e-310: tmp = b * (-0.6666666666666666 / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4e-310) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4e-310) tmp = b * (-0.6666666666666666 / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4e-310], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{-310}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < -3.999999999999988e-310Initial program 70.4%
sqr-neg70.4%
sqr-neg70.4%
associate-*l*70.5%
Simplified70.5%
+-commutative70.5%
add-sqr-sqrt70.3%
fma-define70.3%
Applied egg-rr59.8%
associate-*r*59.9%
*-commutative59.9%
associate-*r*59.9%
Simplified59.9%
Taylor expanded in b around -inf 57.9%
associate-*r/57.9%
*-commutative57.9%
associate-/l*57.9%
Simplified57.9%
if -3.999999999999988e-310 < b Initial program 34.2%
sqr-neg34.2%
sqr-neg34.2%
associate-*l*34.2%
Simplified34.2%
+-commutative34.2%
add-sqr-sqrt32.4%
fma-define31.5%
Applied egg-rr38.6%
associate-*r*38.6%
*-commutative38.6%
associate-*r*38.7%
Simplified38.7%
div-inv38.6%
*-commutative38.6%
Applied egg-rr38.6%
Taylor expanded in b around inf 0.0%
*-commutative0.0%
associate-/l*0.0%
associate-*r*0.0%
*-commutative0.0%
associate-*r/0.0%
unpow20.0%
rem-square-sqrt64.2%
metadata-eval64.2%
Simplified64.2%
Final simplification61.3%
(FPCore (a b c) :precision binary64 (if (<= b 5e-310) (* b (/ -0.6666666666666666 a)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 5e-310) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 5d-310) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 5e-310) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5e-310: tmp = b * (-0.6666666666666666 / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5e-310) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5e-310) tmp = b * (-0.6666666666666666 / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5e-310], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5 \cdot 10^{-310}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 4.999999999999985e-310Initial program 70.4%
sqr-neg70.4%
sqr-neg70.4%
associate-*l*70.5%
Simplified70.5%
+-commutative70.5%
add-sqr-sqrt70.3%
fma-define70.3%
Applied egg-rr59.8%
associate-*r*59.9%
*-commutative59.9%
associate-*r*59.9%
Simplified59.9%
Taylor expanded in b around -inf 57.9%
associate-*r/57.9%
*-commutative57.9%
associate-/l*57.9%
Simplified57.9%
if 4.999999999999985e-310 < b Initial program 34.2%
sqr-neg34.2%
sqr-neg34.2%
associate-*l*34.2%
Simplified34.2%
Taylor expanded in b around inf 64.4%
*-commutative64.4%
Simplified64.4%
Final simplification61.4%
(FPCore (a b c) :precision binary64 (* b (/ -0.6666666666666666 a)))
double code(double a, double b, double c) {
return b * (-0.6666666666666666 / 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 * ((-0.6666666666666666d0) / a)
end function
public static double code(double a, double b, double c) {
return b * (-0.6666666666666666 / a);
}
def code(a, b, c): return b * (-0.6666666666666666 / a)
function code(a, b, c) return Float64(b * Float64(-0.6666666666666666 / a)) end
function tmp = code(a, b, c) tmp = b * (-0.6666666666666666 / a); end
code[a_, b_, c_] := N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
b \cdot \frac{-0.6666666666666666}{a}
\end{array}
Initial program 51.2%
sqr-neg51.2%
sqr-neg51.2%
associate-*l*51.2%
Simplified51.2%
+-commutative51.2%
add-sqr-sqrt50.2%
fma-define49.7%
Applied egg-rr48.5%
associate-*r*48.6%
*-commutative48.6%
associate-*r*48.6%
Simplified48.6%
Taylor expanded in b around -inf 28.5%
associate-*r/28.5%
*-commutative28.5%
associate-/l*28.5%
Simplified28.5%
Final simplification28.5%
herbie shell --seed 2024078
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))